#### Archived

This topic is now archived and is closed to further replies.

# Catmull-Rom splines

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

## Recommended Posts

Hello, I''m thinking of using Catmull-Rom splines for animation paths. I want to have a set of points and their corresponding time values and be able to interpolate smoothly between them. Catmull-Rom splines seem very simple and almost perfect. The only gotcha is that with Catmull-Rom splines (from my understanding) the points must be equally spaced in time. My question is - is there any way they can be extended such that if I have the time value at each control point, I don''t have to make sure that the points are equally spaced? I want to have a set of arbitrary points and at what time the path should reach each one, instead of having p1 at t = 0, p2 at t = 1, p3 at t = 2, etc. Any ideas? Thanks, -Jeremy

##### Share on other sites
No, the controlpoints can be anywhere. I did not notice any constraint on this, I have checked it on 2 sites.

##### Share on other sites
As szinkopa said, the points actually can be anywhere. But here is some stuff to consider that may clarify your understanding of splines:

The spline is typically written as a parametric function of the a knot parameter, where IF you decide that the parameter is time then the time from one knot to the next is the same for each knot. Because of this, if one segment of the spline is longer than the other, if you treat the parameter as time then the average velocity over the longer segment will be greater than the average velocity over the shorter segment, just so the object following each segment can arrive at the next knot at the same time. But, you do not HAVE to choose the parameter to be equal to time. You can do, among other things, an arc length parameterization in which the parameter is equal to the local length of the spline from the starting point. This enables you to have an object follow the spline with a constant velocity. Dave Eberly outlines this in detail over at:

Moving at Constant Speed (parameterize by arc length)

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.

##### Share on other sites
hmm, i had this problem myself for a while and i kept trying to find a way to find the arc length, but couldn''t. then however, i realized that you can just find the derivative at the current point, and use that to control the speed. if you divide the parameter increase by the length of the derivative vector, you get smooth movement. at least, i hope so. the best part it seems is that its pretty damn fast, no integration involved, so the points can move around without having to recalculate a definite integral every time they move, much less detect when they move and do it behind the scenes.

the only problem i could find is it requires that you move the parameter by a velocity, not a distance, which is not a problem for me but might be for you.

##### Share on other sites
I think the arc-length parameterization is what I need... just have to wrap my brain around it. Thanks for the link.

• 17
• 11
• 15
• 9
• 49
• ### Forum Statistics

• Total Topics
631393
• Total Posts
2999774
×

## Important Information

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!