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

    between

    Returns true if check is between start and end angles.

    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

    intersectionDistance

    Returns the distance at which a line from angleRadian hits line. Returns Infinity if there's no intersection.

    intersectionDistanceCompute

    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.

    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)

    lineToCartesian
    multiply

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

    normalise
    polarLineToString

    Returns a string representation of a PolarLine

    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
    toPolarLine

    Converts a line to a PolarLine

    toString

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

    References

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

    Type Aliases

    FromCartesianOptions
    IntersectionDistanceCompute
    ToPolarLineOptions

    Variables

    toCartesian

    Converts to Cartesian coordinate from polar.