Archived

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

v_d_d

B Splines and timing/velocity question

Recommended Posts

Hi, I have started using bsplines for camera/model paths. The usual bspline function uses a ''t'' parameter ranging from [0-1] to compute a position somewhere on the bspline. My question is: How can I calculate a value for this t parameter that will reflect the current speed of the camera or model I want to make follow the bspline path. Ex: if my camera is moving at 8 units per second, how can I find the right interval to use as the t parameter of the bspline function? Because what happens now is that if I have a very short bspline, the camera travels along the path very fast, and if the bspline is long, the camera travels slowly. I have no control on the actual unit/second travelled... Help please :-(

Share this post


Link to post
Share on other sites
From what I remember, there is no mathmatical solution for this. Rather, there is no way to calculate the length of a spline, it has a fractal type nature, the distance you find by taking samples at regular intervals changes depending on the interval itself. So, if you don't know the length, you can't set the speed.

There are two 'solutions' to this problem:
1) Define the time for the entire spline and update t with constant speed. For this to work, the distance moved in the interval f(t) and f(t+delta) should be as near constant as possible.
2) Make time a parameter of the spline, as in: x, y, z, and time. Then, do a binary search to find t for a given time (i.e. if ftime(t) < time, increase t, else decrease t in a binary search way). This allows you to control the camera's speed, which can produce better looking results than the constant speed camera (e.g. if it goes over the top of a cliff, accelerating down the cliff face would add to the effect).

Skizz

[edited by - Skizz on March 3, 2003 1:06:13 PM]

Share this post


Link to post
Share on other sites
It''s solved....It''s only a scool test on first derivative,i think :-). Learn math......

i was wrote program that does drawing of the spline with fixed one-pixel step. It''s not all what you want,but main idea the same:i calculating one point,and 1st derivative by t,and increase t by k/derivative. I always have fixed step for little k.

And,if you like math,more better way avaliable:derive backward fulction of the length of curve by t.
It''s simple integral of sqrt((dx/dt)^2+(dy/dt)^2+(dz/dt)^2) of the spline function...
First way is a non-analitycal solve of this integral .

Share this post


Link to post
Share on other sites
I could be wrong, but I don''t think splines are fractal in nature at all. I don''t remember for sure, but I think B-splines are cubic parametric functions. You can find an approximation for the length of the spline by just finding the distances between control points. If you are doing movies, then you can afford to find much more accurate lengths by taking smaller t-steps between control points, but if you are doing real-time graphics, you can just find a crude approximation. You then use the approximation of the length to find appropriate t-steps.

Share this post


Link to post
Share on other sites