Function douglasPeuckerWorkspaceSize

Returns the maximum workspace length required by trySimplifyDouglasPeuckerInto() for a polyline containing pointCount stored points.

ulong douglasPeuckerWorkspaceSize(
  ulong pointCount
) pure nothrow @nogc @safe;

Empty, singleton, and two-point polylines require no auxiliary workspace.

For larger inputs, the iterative Douglas-Peucker implementation may defer at most one right-hand section for each intermediate input vertex.

Returns

max(pointCount - 2, 0)

No allocation is performed.

Complexity

O(1) time and O(1) auxiliary space.