Constant speed animation along cubic Hermite spline?

Started by
3 comments, last by Prune 10 years, 4 months ago

I couldn't find clear information about arc-length parameterization of cubic Hermite splines. How would I do this? I need to be able to do position=CalcPos(t) where the distance traced out by position is proportionate to delta-t. What's the best way to do this?

"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
Advertisement

One quick and hacky way to do it is to advance along the curve using very tiny increments of the curve parameter, s, accumulating distance as you go until you reach the distance you want to move. It's not as elegant as a numerical solution, but it's easy to do and should probably be fast enough for most applications.

You could do what FLeBlanc suggested. Calculate position for some value t and than find the distance between current position and last position. Check to see if distance is greater or smaller than the distance you wanted to pass. If it is then move along that distance by the amount you want.

Yeah, as far as I know, there's not a simple arc-length formula you can plug a parameter into. You'd have to do some numerical integration at some point. I guess FLeBlanc's method is a type of numerical integration as well, but it's way more suited to a gaming application.

Thanks. Looks like I might stick to the 1D case with a spline per degree of freedom that animation tools can export, where arc length isn't an issue.

"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)

This topic is closed to new replies.

Advertisement