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
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 rotated coordinate
Returns a rotated coordinate
Produces an Archimedian spiral with manual stepping.
Returns a human-friendly string representation (distance, angleDeg)
.
If precision
is supplied, this will be the number of significant digits.
Polar coordinate, made up of a distance and angle in radians.
Most computations involving PolarCoord require an origin
as well.
A polar ray is a line in polar coordinates It consists of an angle (in radians) with a given offset and length.
Converts to Cartesian coordiantes
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