Archived

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

Following a Bezier Curve

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to implement some code to follow a bezier curve. I can draw the thing with no problem, with the glEvalCoord() function, but I can''t grab the coordinates to translate too. Anyone know the best way to do this or can point me in the right direction? I''ve tried to find a tutorial or something on it, but with no luck. Thanks

Share this post


Link to post
Share on other sites
The basic is this:

Give 3 points that make up the curve (p0, p1, p2) and a parameter t which varies from 0 to 1 (0 being the start of the curve, 1 being the end) any point on the curve can be calculated like so:

P(t) = ((1 - t)^2)*p0 + 2*(1-t)*t*p1 + t^2*p2

note: x^2 = x squared, not x xor 2


Here is an article on rendering bezier surfaces. Before getting to surfaces they talk about bezier curves which should help you out.

Clicky

You will need a gamasutra registration (free)



[edited by - terminate on March 23, 2004 6:40:51 PM]

Share this post


Link to post
Share on other sites