Reputation: 1164
Strict facts:
if( m_fBezierTime < 1.0 ) {
m_fBezierTime += 0.1f * fDelta;
m_vPosition = m_Bezier.CalculatePosition(m_fBezierTime);
}
This kind of approach gives 'huge' acceleration between points that have a higher distance than those being close to each other.
I have heard this is normal behavior of the Bezier
Now the question :
Thanks for any comments on this.
Upvotes: 2
Views: 1938
Reputation: 32258
Simple and fast solution: Get a bunch of regularly distributed points on your Bezier curve (for example 10 points per curve) like you are doing now and measure the Euclidian distance between those points (meaning: sqrt((x_1 - x_2)² + (y_1 - y_2)² … )). This should be a good measure for the length of the full curve, which you can use than to traverse with nearly constant speed.
There is more nifty stuff going on around here: http://steve.hollasch.net/cgindex/curves/cbezarclen.html but that might be overkill.
Upvotes: 2