tracebezier

Algorithm to "trace" sequential points into bezier curves


I have a sequential collection of points in X,Y and I'd like to "trace" these into a set of bezier curves. Could any open source bitmap to vector tracing algorithm or library be used for this?


Solution

  • This depends on what you want to accomplish. If you want to see the 'best fit' curve, or at least a rough approximation, you should use a b_spline. A b_spline will fit itself 'inside' the points it is given. For going through the points in question I would generally use a Catmull-Rom spline which, when given points 1,2,3 will pass through point 2 with slope equal to the slope between points 1 & 3.

    Sample Code: http://willperone.net/Code/spline.php

    Explanation of the algorithm: http://steve.hollasch.net/cgindex/curves/catmull-rom.html