Sign in to follow this  

Catmull-rom *tangents* (not gradients)

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Looking at this thread: http://www.gamedev.net/community/forums/topic.asp?topic_id=140427 Alrighty. Gradients are great - except when you need a *tangent* (i.e. - something with length and direction or 2D coordinates). In my case, the latter. I need separate (x,y) coordinates where x = relative frames from current and y = absolute value to set the spline-interpolated keyframe tangents. For some reason, I don't think that one float value satisfies this. Since the spline tangent is unbroken, it is easy enough to negate (x,y) to get both the left and right tangents (incoming-outgoing). Any ideas on how to do this? Thanks.

Share this post


Link to post
Share on other sites
I'll answer this myself:

These codes from the aforementioned topic suck as they return a single float value. In reality (see Dave Eberly e.g.) these equations should return a tangent VECTOR!!! I stress this since my solution requires a tangent VECTOR. His maths work great in this respect - as he elucidated directly to me.

But Catmull-Rom or Kochanek-Bartels splines won't work for me here. The solution requires C2 continuity (not C1 piecewise continuity). What I'm trying to figure out is what class of splines works here. There seems to be an affluent amount of throwing about terms such as 'cubic splines' are piecewise. Okay, but there are cubic splines that aren't. B-Splines seem to be piecewise or not. Natural cubic splines similarly.

Let me reiterate the requirements:

Given a set of nonuniformly distributed control points (keyframes),
Solve for the tangent vectors of each with a C2 continuous spline that includes the control points on the curve.

I don't give a hoot about interpolating points between keyframes as the destination animation system involved handles this already. What I need is to fit a curve that matches one from a source animation system. Unfortunately, the entire specification for spline interpolation of the source system is 'it's spline interpolation'. No information on tangents or other parameters exists. The source animation system does indeed show C2 continuity - changes in any keyframe ripple across the entire animation curve.

I'm not well versed in the math, terminology, variations involved here. I do realize that there are about a bazillion types of curve in a large number of categories with more methods (with calculus, vector analysis, and matrices to boot) to throw at them then can be imagined. That doesn't make it easy to focus on a few particular types for algorithmizing and testing for efficacy.

Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kuroyume0161
Given a set of nonuniformly distributed control points (keyframes),
Solve for the tangent vectors of each with a C2 continuous spline that includes the control points on the curve.


Your requirements appear to allow any C2-continuous curve that passes through the sample points. Use a "natural spline". An implementation is in my curve classes Wm4NaturalSpline{2,3}.{h,cpp}. Once you have constructed the natural spline, evaluate the first derivative at each sample point. Unit-length tangents are obtained by normalizing the first derivatives.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dave Eberly
Your requirements appear to allow any C2-continuous curve that passes through the sample points. Use a "natural spline". An implementation is in my curve classes Wm4NaturalSpline{2,3}.{h,cpp}. Once you have constructed the natural spline, evaluate the first derivative at each sample point. Unit-length tangents are obtained by normalizing the first derivatives.


I'm replying here since my internet connection is once again down (using satellite alternative at the moment). Nice paying $400/mo for a full T1 - business grade (out in the middle of nowhere) - and having it go down for any length of time. No fix until Monday. Grrr.... :(

I sent an email with examples and the new code. If you can formulate a 1D version that will work with the animation keys to get the tangents that would be great. So far, I haven't found any other code that does this for natural cubic splines - lots of interpolation, not so much on tangents.

You can email me at my alternative email address (the DNS servers and Mail server are both connected to the T1 - drat and Grrrr!) which I will use to establish the connection to you.

Thanks!

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this