Point geometry with transforms. Fork of @mapbox/point-geometry that works on plain {x, y} points.
$ npm install --save @mapwhit/point-geometry
A standalone point geometry with useful accessor, comparison, and modification methods.
Clone this point, returning a new point that can be modified without affecting the old one.
Converts a point-like object to a Point
object.
Clone this point, returning a new point that can be modified without affecting the old one.
Creates a new point from x and y coordinates.
Return the magnitude of this point.
Compare this point is to another point.
Calculate the distance from this point to another point.
Calculate the distance from this point to another point, without the square root step.
Get the angle from the 0, 0 coordinate to this point, in radians.
Get the angle from this point to another point, in radians.
Get the angle between this point and another point, in radians.
Find the angle of the two vectors.
Multiply point by a 2x2 matrix.
Add two points.
Subtract two points.
Multiply point by a scalar.
Divide point by a scalar.
Multiply point by another point.
Divide point by another point.
Normalize point.
Calculate the perpendicular of a point.
Rotate a point by an angle.
Rotate a point around another point.
Round the coordinates of a point.