README
vector2
vector2 is vector calculator
Usage / Installation
You can install vector2 using npm
npm i @smarsh1/vector2
Example
const Vector = require('@smarsh1/vector2');
let vec = new Vector(2, 3);
console.log(vec.add(5, 6));
// expected output: 7, 9
Documentation
Constructor
const Vector = new Vector2(x, y)
Add
add(x, y);
//
add(otherVector);
Subtract
sub(x, y);
//
sub(otherVector);
Multiplcate
multi(x, y);
//
multi(otherVector);
Divade
div(x, y)
//
div(otherVector)
Lenght
len()
Normalize
norm()
License
MIT