Vector
object for canvas etc.
$ component install component/vector
var Vector = require('vector');
var a = new Vector(5, 5);
var b = new Vector(10, 10);
a.distance(b);
or without new
:
var vec = require('vector');
var a = vec(5, 5);
var b = vec(10, 10);
a.distance(b);
Initialize a new Vector
with x / y.
Return a negated vector.
Add x / y.
Sub x / y.
Multiply x / y.
Divide x / y.
Check if these vectors are the same.
Return a clone of this vector.
Return angle in radians.
Return angle in degrees.
Return the distance between vectors.
Return the linear interpolation between vectors given a step point.
Return the middle position between vectors.
Return "(x, y)" string representation.
MIT