# curve to fit a series of points

This topic is 4906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

spline, polyline, bspline, NURB, bezier, catmull-rom? what should i use?

##### Share on other sites
Why do you need to fit the points? Do you need to interpolate or extrapolate? Does it matter if your curves are piecewise second order continuous? First order continuous?

##### Share on other sites
it's for interpolation, and the curve needs to hit all points on the path. the problem i'm having is how to generate the control points.

##### Share on other sites
Well, both a polyline and a b-spline will hit all points on the path. But they look completely different; a polyline is made up of straight lines with sharp bends at the points (what SiCrane was talking about with first-order continuity) whereas a b-spline is smoother. Use whatever curve formulation fits the visual results you're trying to achieve.

##### Share on other sites
bsplines it is then. how do you generate the control points for the curve to pass through all the points on the path, though?

##### Share on other sites
You can basically solve a system of equations which sets the vertices as the internal knots of the spline.

Alternatively, BTW, you could use a bezier spline, with the tangent for a point P(n) equal to (P(n+1)-P(n-1))/2. I forget what this method is called..... someone chime in?

##### Share on other sites
http://www.cubic.org/docs/hermite.htm

found this, sounds like catmull-rom is what i'm after. can anyone confirm this?

##### Share on other sites
Catmull-Rom splines are equivalent to Bezier curves with the tangent generation I described.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 11
• 15
• 14
• 46
• 22
• ### Forum Statistics

• Total Topics
634054
• Total Posts
3015274
×