• Douglas-Peucker on a closed loop. The standard recursive form needs two fixed endpoints; we pick them as vertex 0 + the vertex farthest from vertex 0, split the loop into two open arcs there, simplify each via douglasPeuckerOpen2D, and stitch the result back into a closed ring.

    Robust against starting at a collinear vertex, which would otherwise cause a degenerate first segment.

    Returns the original loop when simplification would leave fewer than three vertices.

    Parameters

    • loop: readonly Point2D[]
    • epsilon: number

    Returns Point2D[]