Building a smooth set of parametric curves from a sorted list of points in a plane

Started by
0 comments, last by Dave Eberly 14 years, 5 months ago
I want to let my users freehand draw curves, and then replace what they drew with a smooth approximation by a series of parametric curves (splines). Whatever method I choose, I'd like to be able to adjust the threshold of how closely the curves need to match the original data. That is, I'd like to play with representing their input as just a few large curves vs. many smaller curves that match it more closely. I see this happen in many vector drawing applications, so I feel like this is a pretty solved problem. Some quick Googling on fitting splines to arbitrary points turned up some information, but basically all of it assumes that you're fitting splines to a small number of points. I'm fitting splines to a very large number of points, not all of which probably need to contribute to the end result. Any pointers? Or functions ready to go? [smile]
Advertisement
Take a look at BSplineCurveFitter, which uses a least-squares fitting algorithm. The application is set up for 3D, so you can set z = 0 for all the input points or replace the Vector3 by Vector2 in the code. You get to select how many control points you want, say, as a percentage of the total number of input samples. It does not matter how large the number of samples.

This topic is closed to new replies.

Advertisement