R – How many points for a spline


H community,

I wanted to ask if there is an algorithm for choosing the optimal amount of support points for creating a bezier spline in order to make it look smooth and reduce the error. If there is such an algorithm how fast is the algorithm?

Thanks in advance


Best Solution

Generally you don't want to work with Bezier curves of higher order than cubic. The evaluation and rendering gets slower as the order goes up. Cubic curves are also supported by most display libraries, higher orders you'll need to render yourself.

If you're trying to approximate data with Bezier curves, there's a whole host of approximation algorithms that reduce densely packed data to Bezier curves. If you're looking for a way to draw curves with many points, B-Splines curves may be a useful solution. These are easily converted to Bezier curve segments for rendering. See this paper for a basic introduction to B-spline curves.