It can be done by recursively refining part which is not near segment between part ends.
If we have curve (spline) C:[0,1]->R^n
. Than first approximation is segment S
between curve end points [C(0), C(1)]
. Take point C(0.5)
and check how far is it from segment S
. If it is far than we have to take it in discretization, if not than S
is good approximation. If C(0.5)
is far, than next approximation is polyline [C(0), C(0.5), C(1)]
, and we make same procedure with parts [C(0), C(0.5)]
and [C(0.5), C(1)]
.
If you are using polynomial spline of order >= 3 (e.g. cubic spline) than it can have inflection point(s). In that case it is possible that curve point on half can 'fall' right on segment, but curve around to be far from segment. In that case it is good to check one more level of sub-parts.