How this calculation works
Retain the fewest original polyline vertices subject to a directed point-to-shortcut distance bound.
D(j)=1+min D(i) over valid shortcuts i→j; D(0)=1.A worked example
At tolerance0.1, the five default points simplify to indices0,3,4. The greatest shortcut error is0.05.
Good to know
2–150 ordered planar points, nonnegative tolerance≤100000. Original endpoints retained; only subsequences allowed. Local directed distance to each corresponding finite chord, not symmetric Hausdorff or Frechet distance.
Reference: Bringmann and Chaudhury: polyline simplification distance conventions (opens in a new tab) ↗
Simplification as an optimization problem
An ordered polyline records both locations and traversal order. Simplification replaces a run of its original segments by one straight shortcut. Here the objective is to retain as few original vertices as possible while ensuring that every omitted vertex stays within the stated distance of its corresponding shortcut.
This differs from drawing a smooth fitted curve or moving vertices to improve a visual approximation. Every retained coordinate comes directly from the input, the first and last points stay fixed, and the order cannot change. The numerical guarantee refers to the declared local directed distance rule.
Compare this with the Discrete Frechet distance calculator for two ordered polylines. Choose a subsequence with the fewest retained vertices under a specified chord-error rule, rather than measure distance between two supplied curves.
Choosing a meaningful tolerance
The tolerance uses the same coordinate unit as the points. If coordinates are meters, a tolerance of zero-point-one means a tenth of a meter. It is not a percentage of the overall curve length, and it is not automatically adjusted for the size of the bounding box.
A larger tolerance makes more shortcuts admissible and can only maintain or reduce the minimum retained count. At zero tolerance, only exactly collinear runs that remain on their replacement chord can disappear. A bend that reverses beyond a chord endpoint may require retention even when its supporting infinite line is nearby.
Working through the default points
The first four default points lie near the horizontal segment from zero to three. Their vertical offsets are zero, positive zero-point-zero-five, negative zero-point-zero-five and zero. Replacing that run by one chord produces a maximum point-to-segment distance of zero-point-zero-five.
The final point rises to four comma one. Connecting the first point directly to that endpoint would exceed the allowed zero-point-one tolerance at intermediate observations. The minimum valid result therefore keeps indices zero, three and four: a horizontal chord followed by the final sloped segment.
Testing a possible shortcut
For a candidate shortcut from point i to point j, the algorithm projects every intervening observation onto the finite segment. Projection parameters are clamped between zero and one, so the distance is measured to an endpoint whenever the perpendicular foot lies outside the actual chord.
The largest of those distances is stored as the shortcut cost. A chord becomes an edge in a forward directed acyclic graph only when its cost fits the tolerance. A shortest path through that graph minimizes retained vertices, giving a global optimum for this finite subsequence problem.
Why the bound covers original segments
Distance to a fixed convex segment is a convex function along a straight input segment. Its maximum over that segment is therefore no greater than the larger endpoint distance. Checking all original vertices in a replaced run also bounds every point on its piecewise-linear segments in the directed sense.
The reverse direction is different. A replacement chord may pass through space far from the original polyline even when every original point is close to the chord. This page consequently does not advertise symmetric Hausdorff distance, preservation of traversal speed or the stronger ordering constraints of a Frechet coupling.
Reading indices and optimality
The output lists retained zero-based row indices, their unchanged coordinates and the greatest error among selected shortcuts. If several subsequences have the same smallest count, the dynamic program returns one of them. An alternative optimum need not use the same middle vertices to satisfy the same bound.
The optimum is over original-vertex subsequences only. Allowing newly placed endpoints or a different error metric changes the feasible set and can change the count. Comparing this answer to a smoothing package without matching those choices is not a test of either implementation's correctness.
Practical checks before exporting
Plot both paths and inspect features that matter to the intended use. A small directed distance does not guarantee preservation of self-intersection patterns, enclosure area, turning angles or a road network's connectivity. Those are separate constraints and are not silently added by this calculator.
For a short input, enumerate all endpoint-preserving subsequences to verify the minimum count independently. Translating or rotating the coordinates should preserve the answer, while uniformly scaling coordinates requires scaling the tolerance as well. These checks help distinguish unit mistakes from an actual geometric change.
A few questions, answered
Does it move any point?
No. The result is an ordered subsequence of the original coordinates with both endpoints retained.
Is this Douglas–Peucker simplification?
No. It solves a shortest-path dynamic program for the declared shortcut rule, minimizing retained vertex count.
Does it preserve topology?
No. Self-intersections and other topological constraints require separate checks.
Why is the distance directed?
It bounds original subcurve points to their replacement chord. It does not impose the reverse-distance condition.