Jump to content
  • Advertisement
Sign in to follow this  
JDX_John

Calculating parameter for each point on a Catmull-Rom Spline

This topic is 2522 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

On the wiki page we have this equation for interpolating between two spline control points, where the parameter t is normalized in the range [0,1]:
80984aec3175ea7a01f3c67c8ba00e38.png

That's fine. But, to use it generally we need to be able to assign a parameter value t[sub]k[/sub] to each control point p[sub]k[/sub], so that when interpolating at any point along the spline we can choose which section to use, and how to normalize t into the 0,1 range for that section.

How can we calculate tk correctly without knowing the spline length, which in turn requires knowing the spline equations first?! Maybe the wiki article covers it, but the notation got too confusing for me!

Share this post


Link to post
Share on other sites
Advertisement
[color=#000000][font=sans-serif]

On the unit interval [/font][color=#000000][font=serif]

(0,1)[/font][color=#000000][font=sans-serif]

, given a starting point [/font]p[sub]0[/sub][color=#000000][font=sans-serif]

at [/font][color=#000000][font=serif]

t = 0[/font][color=#000000][font=sans-serif]

and an ending point [/font]p[sub]1[/sub][color=#000000][font=sans-serif]

at [/font][color=#000000][font=serif]

t = 1[/font][color=#000000][font=sans-serif]

with starting tangent [/font]m[sub]0[/sub][color=#000000][font=sans-serif]

at [/font][color=#000000][font=serif]

t = 0[/font][color=#000000][font=sans-serif]

and ending tangent [/font]m[sub]1[/sub][color=#000000][font=sans-serif]

at [/font][color=#000000][font=serif]

t = 1[/font][/quote]
I think it tries to say when t=0 your spline will be at p[sub]0, while t=1 results in [/sub]p[sub]1. Basically t is interpolation variable between two points.[/sub]
[color=#000000][font=sans-serif]Using all values between (0; 1) you'll get infinite amount of points which form your spline. Therefore you can choose 10, 40, 100 or milliion points, depending on quality you need.[/font]

[color=#000000][font=sans-serif]Sorry about font weirdness, editor is really stupid.[/font]

Share this post


Link to post
Share on other sites
Ok so... You can have two situations: 1) you have the points in space (say 3D) with their parameter values preassigned 2) you have just the points in space.

In the first case the situation is straight forward - you just proceed as the article says, that is for each parameter interval you normalize it to (0,1) and the use the formula you posted.

In the second case you need to parametrize the data and there is no "one way" of doing it as different metods give different results. Try to google for "uniform parametrisation", "chord lenght parametrisation" and "centipetal parametrisation".

Share this post


Link to post
Share on other sites

Ok so... You can have two situations: 1) you have the points in space (say 3D) with their parameter values preassigned 2) you have just the points in space.

In the first case the situation is straight forward - you just proceed as the article says, that is for each parameter interval you normalize it to (0,1) and the use the formula you posted.

In the second case you need to parametrize the data and there is no "one way" of doing it as different metods give different results. Try to google for "uniform parametrisation", "chord lenght parametrisation" and "centipetal parametrisation".
Yes it's the 2nd case, I just define spline as set of 3D points. So I'm correct to be a bit confused, it seems :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!