1.0.2 • Published 2 years ago

@decoy9697/vector v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Vector 2D

Build Coverage Downloads Size

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:

NameType
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