Dense [station, value] points in strictly increasing station order.
Largest admitted deviation, the values' units (0.5 mm by default).
Indices of named landmarks to keep.
Indices of flagged samples to leave out of the fit and its error (holes, spikes, saw teeth).
The knots in station order and the largest deviation of any kept dense sample from its span.
The fewest value-and-slope knots that hold a dense run within the tolerance. Every sample starts as a knot with its central-difference slope; knots are then removed one at a time, always the one whose removal deviates least, while that deviation stays within the tolerance. On each removal the two neighbouring knots' slopes are refitted by least squares to the dense samples of the three spans they shape (knot removal with a least-squares approximation, Lyche and Morken, Knot removal for parametric B-spline curves and surfaces, CAGD 4, 1987), so facet noise in the samples does not enter the slopes, and the deviation is the largest over those spans' samples. Knot values stay the samples' own.
Never removed: the ends, the pinned indices, and the prominent features: a local extremum whose topographic prominence exceeds twice the tolerance (its slope is held at zero, so the curve's extremum is the sample's), and an inflection (sign change of the divided second difference) between two bends whose sagittas exceed twice the tolerance after the weaker wiggles merge away. Twice the tolerance is the noise threshold because a curve through the middle of a bump that high stays within the tolerance of both its top and its foot without a knot of its own.