charton API / @chart-on/core / index / simplifyPolyline
Function: simplifyPolyline()
simplifyPolyline(
points,tolerance):number[]
Defined in: packages/core/src/drawing/geometry.ts:110
Indices of the points a simplified polyline keeps. The first and last points are always kept; no dropped point lies further than twice tolerance from the kept line.
A radial pass first drops points within tolerance of the previous kept point, which is linear and thins densely sampled strokes. Ramer-Douglas-Peucker then runs on what is left: typically O(n log n), O(n²) in the worst case (every split peels off a single point), so callers with very long input should cap or pre-thin it.
Parameters
points
readonly Point[]
tolerance
number
Returns
number[]