ixfx
    Preparing search index...

    Namespace 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

    Namespaces

    Ray

    Functions

    clampMagnitude

    Clamps the magnitude of a vector

    divide

    Divides the magnitude of a coord by amt. Direction is unchanged.

    dotProduct

    Calculate dot product of two PolarCoords.

    fromCartesian

    Converts a Cartesian coordinate to polar

    guard

    Throws an error if Coord is invalid

    invert

    Inverts the direction of coordinate. Ie if pointing north, will point south.

    isAntiParallel

    Returns true if coords are opposite direction, regardless of magnitude

    isOpposite

    Returns true if PolarCoords have same magnitude but opposite direction

    isParallel

    Returns true if Coords have the same direction, regardless of magnitude

    isPolarCoord

    Returns true if p seems to be a Polar.Coord (ie has both distance & angleRadian fields)

    multiply

    Multiplies the magnitude of a coord by amt. Direction is unchanged.

    normalise
    rotate

    Returns a rotated coordinate

    rotateDegrees

    Returns a rotated coordinate

    spiral
    spiralRaw

    Produces an Archimedian spiral with manual stepping.

    toLine

    Converts a polar coordinate to a Line.

    toPoint
    toString

    Returns a human-friendly string representation (distance, angleDeg). If precision is supplied, this will be the number of significant digits.

    References

    Coord → Coord
    PolarRay → PolarRay
    PolarRayWithOrigin → PolarRayWithOrigin
    PolarToCartesian → PolarToCartesian

    Variables

    toCartesian

    Converts to Cartesian coordinate from polar.