Robin Rodricks
Robin Rodricks

Reputation: 113976

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?

Upvotes: 5

Views: 2820

Answers (2)

TJ Seabrooks
TJ Seabrooks

Reputation: 20723

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

Upvotes: 4

U62
U62

Reputation: 4363

You want to use piece-wise b-spline curves rather than beziers if you want the curve to pass through an existing set of points.

There's tons of code on the web for doing this.

Upvotes: 0

Related Questions