Const velocity movement along bezier curves

Hi ppl

As in a topic…Lets say we have a bezier curve ( which is parametric one of course ) but we wish to move with the same speed all the way…I cant just increment the parameter the same all the time 'cause it does not guarantee the constant distance move along the curve.
Here is a pic which illustrates the prob:

This curve is sampled 20 times ( t = 0:1 with t_step = 1/20 ). You can see that distances between sample points in the middle of the curve are greater than those at the begining and end of it. So, I cant move basing on t parameter.( or lt least I cant figure it out :stuck_out_tongue: )

Is there a way to overcome this ? The analitical solution would be the best of course. Up to now I figured out the interative solution but maybe there is faster way ( it will be implemented on mobile phones ).

Thx in advance!

Hi !

Not sure of any fast interactive way to do it, as the parametrics space does not have anything to do with the 3D space it would be tricky, but if you could preprocess it a little that might work, you could get a number of samples and get the distance between the 3D points at each sample and use that to calculate the speed to use between two samples, it is not very exact though.

what you need is a function based on the curve length and not on t. as i see, you already have a function for computing the length of a curve.

f(t = 1) = length
f(t = 0) = 0

what you need is the inverse of that function

f’(length) = 1 => t = 1
f’(0) = 0 => t = 0
f’(length/4) != 0.25 most of the time :slight_smile:

which would give you a proper t for a given length. when using constant steps over the length you will get a constant movement along the curve. but inverting the function is not as easy at it might seem to. you have to to numerically integrate over the curve, but you already did it i think (for getting the length).

David Eberly has a lot sourcecode online dealing with curves and their parametrization. maybe this link can help you.