@decoy9697/vector
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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:

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

Readme

Keywords

Package Sidebar

Install

npm i @decoy9697/vector

Weekly Downloads

23

Version

1.0.2

License

MIT

Unpacked Size

18 kB

Total Files

10

Last publish

Collaborators

  • decoy9697