PeeS
PeeS

Reputation: 1164

Bezier Curves ( Path ) - More less constant speed when traversing through T

Strict facts:

if( m_fBezierTime < 1.0 ) {

m_fBezierTime += 0.1f * fDelta;

m_vPosition = m_Bezier.CalculatePosition(m_fBezierTime);

}

Now the question :

Thanks for any comments on this.

Upvotes: 2

Views: 1938

Answers (1)

filmor
filmor

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

Related Questions