Returns true if check is between start and end angles.
Clamps the magnitude of a vector
Divides the magnitude of a coord by amt.
Direction is unchanged.
Calculate dot product of two PolarCoords.
Converts a Cartesian coordinate to polar
Throws an error if Coord is invalid
Returns the distance at which a line from angleRadian hits line. Returns Infinity
if there's no intersection.
Returns a generator function that checks for intersections with a static set of lines.
The generator yields values of { distance: number, line: PolarLine }. Lines which have no
intersecton are not returned.
Inverts the direction of coordinate. Ie if pointing north, will point south.
Returns true if coords are opposite direction, regardless of magnitude
Returns true if PolarCoords have same magnitude but opposite direction
Returns true if Coords have the same direction, regardless of magnitude
Returns true if p seems to be a Polar.Coord (ie has both distance & angleRadian fields)
Multiplies the magnitude of a coord by amt.
Direction is unchanged.
Returns a string representation of a PolarLine
Returns a rotated coordinate
Returns a rotated coordinate
Produces an Archimedian spiral with manual stepping.
Converts a polar coordinate to a Line.
Converts a line to a PolarLine
Returns a human-friendly string representation (distance, angleDeg).
If precision is supplied, this will be the number of significant digits.
Converts to Cartesian coordinate from polar.
Work with Polar coordinates. A Polar.Coord is just
{ angleRadians:number, distance: number }.Conversion: toCartesian, fromCartesian, toString
Math: divide, invert, multiply, dotProduct
Geometric manipulations: rotate, rotateDegrees
Cleaning: clampMagnitude, normalise
Debugging: toString
Comparisons: isAntiParallel, isOpposite, isParallel, isPolarCoord