point2d
A point in 2d space
npm install point2d --save
Example
var Point = ; var point1 = 1 2;console; // 1console; // 2 var point2 = ; // (0, 0) console; // 5 console; // 7 console; // (3, 4) console; // true console; // (3, 5) console; // (0, 1)
Methods
Point.distance(point2d)
Returns the Euclidean distance between this point and another point
Point.manhattanDistance(point2d)
Returns the Manhattan distance between this point and another point
Point.abs()
Returns a new point with coordinates in absolute value
Point.equals(point2d)
Returns true if the x and y coordinate of this point equals the x and y coordinate of the other point
Point.add(point2d)
Returns a new point with the coordinates added together
Point.sub(point2d)
Returns a new point with the coordinates of this point subtracted by the other point