• 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[]