B-Spline walking at constant speed

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

Recommended Posts

Hi all, I have a question about B-Splines, but it probably applies to other curves as well. I've been thinking about using B-Splines some time and finally have some implementation that also includes derivatives. But now I have a question about their application. They are very widely used and I was thinking of using them to do camera movement and other path related things. So I can use the calculated position I'm currently using for the position and the derivative to point the camera or other object traveling along the curve. But I'm having trouble letting the camera travel at a constant speed. As some parts of the curve can be more stretched than others. This could probably be solved by changing the control points, but this isn't desirable. Is there a way to travel over a curve with a constant speed? Would forward difference also help here, as I've read that some people use this? Or could this make things more difficult? Thanks, Joren

Share on other sites
You need to re-parametrize the spline with respect to arc-length. Lots of article on how to do this.

Share on other sites
Ok, thanks. And I was thinking I had read almost everything on splines in the last few days. Those are some new terms. Always good to get new input.

By the way, my current implementation only covers uniform cubic B-Splines, but I would really like to clamp them (interpolate begin and end point). But I believe this requires me to have different basis functions for each knot. Am I correct? Now I'm using 1 matrix, which really makes things easy. Is there an easy way to clamp the spline? The way I do it now is extend the first and last segment with one extra point. But is there another way?

Thanks,
Mox

Share on other sites
Are you setting the t values for each control point individually? Or you just setting the t values to 0, 1, 2 .. n?

If you manually set the t values for each control point then you can model a constant speed for the camera, and still have it accelerate where you want to. This is how all major 3d programs work, i.e. setting a key at a specific time. If you want things to move things slower you simply change the time values for the keyframes by moving them further appart in the timeline.

If you dont want to do that then the simplest solution is to integrate your t parameter while travering the spline. In the simplest form using euler integration it would look something like this each frame:

float dlength = spline.derivate(t).length();// Need to check for singularityif (dlength < EPSILON) {    // Advance t using constant speed approximation   t += constant_speed / dlength; } else {   // Fallback using a small t-velocity until    // so we move away from the singularity in the derivative   t += constant_t_speed;}

For greater precision, other forms of integration can be used. The singularity can also be handle better, but if you only have a smooth b-spline, then it should never occur anyway.

Share on other sites
Thanks for the link Maze Master, that article has a lot of interesting techniques.

Currently I only have uniform B-splines with no extra info for the control points for movement. So the Euler integration looks interesting. I'll see which method works best, that one or one of the methods in the article.

What do you mean by singularities? Discontinuities in the spline? Due to knots with higher multiplicity or something like that? So I probably don't have to worry about that with uniform B-splines.

And any thoughts about clamping the spline?

Thanks,
Mox

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• Forum Statistics

• Total Topics
633710
• Total Posts
3013486
×