@decoy9697/vector
v1.0.2
Published
A 2d vector library
Downloads
91
Readme
Vector 2D
Installation
npm install @decoy9697/vector
This library defines a Vector
as a tuple with 2 floats: [number, number]
It exposes the following functions for working with these vectors:
| Name | Type |
| --------------- | ---------------------------- |
| add | (Vector, Vector) => Vector
|
| cross | (Vector, Vector) => number
|
| degreesToVector | (number) => Vector
|
| distance | (Vector, Vector) => number
|
| dot | (Vector, Vector) => number
|
| length | (Vector) => number
|
| multiply | (Vector, number) => Vector
|
| normalise | (Vector) => Vector
|
| radiansToVector | (number) => Vector
|
| subtract | (Vector, Vector) => Vector
|
| vectorToRadians | (Vector) => number
|
Development
This project uses nix to install dependencies for the development shell.
Commands
nix-shell
- starts a development shell with system dependencies
Within the shell
yarn
- install project dependencies
yarn test
- run the tests
yarn format
- run the linter