Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • getPointSegmentDistanceSq(px: number, py: number, ax: number, ay: number, bx: number, by: number): number
  • Returns the distance squared from the point to the line segment.

    Behavior is undefined if the the closest distance is outside the line segment.

    Parameters

    • px: number

      The X position of point (px, py).

    • py: number

      The Y position of point (px, py)

    • ax: number

      The X position of the line segment's vertex A.

    • ay: number

      The Y position of the line segment's vertex A.

    • bx: number

      The X position of the line segment's vertex B.

    • by: number

      The Y position of the line segment's vertex B.

    Returns number

    The distance squared from the point (px, py) to line segment AB.

  • simplifyPath(sourceVertices: FloatPoint[], maxGap: number, simplifiedVertices?: FloatPoint[], workingVertices?: FloatPoint[]): FloatPoint[]
  • Simplify a path according to an allowed gap.

    The simplified path vertices are the same instances as the one in the source. They must be cloned to make them truly independent from each other.

    Parameters

    • sourceVertices: FloatPoint[]

      The path to simplify.

    • maxGap: number

      The maximum distance the edge of the contour may deviate from the source geometry.

    • simplifiedVertices: FloatPoint[] = []

      The simplified path.

    • workingVertices: FloatPoint[] = []

      It avoids allocations.

    Returns FloatPoint[]

Generated using TypeDoc