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.

    toPoint
    toString

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

    Type Aliases

    Coord

    Polar coordinate, made up of a distance and angle in radians. Most computations involving PolarCoord require an origin as well.

    PolarRay

    A polar ray is a line in polar coordinates It consists of an angle (in radians) with a given offset and length.

    PolarRayWithOrigin
    PolarToCartesian

    Converts to Cartesian coordiantes

    Variables

    toCartesian

    Converts to Cartesian coordinate from polar.