Jump to content
  • Advertisement

Archived

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

shurcool

My Cubic Bézier Curve learning day

This topic is 5218 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

Hi, Today I finally decided to go ahead and learn all about curves, which will be needed for a [yet another] future (2D) game. All it took me was one day (well, it''s not a lot, so it''s ok). I chose the cubic bezier curve (as opposed to a quadric bezier, or even splines and the rest of them curve types) because of their ease of use (when it comes to ''drawing'' them), flexibility and power. Thanks to this excellent article on Gamasutra (registration required, but it''s definitely worth it, as it contains many more very useful articles, if case you didn''t know), I had the theory down in no time. The simple test Java applet followed soon after. You can check it out here. You can see the source at the same URL, just change .html to .java. Keep in mind it''s not optimized or anything like that, but feel free to use it if you really want (not that it''s anything worth using ). Anyway, this concludes my conclusion of the cubic bezier curve learning day. Next comes figuring out our level data format... Perhaps try out XML, etc. Night. ---
shurcooL`

Share this post


Link to post
Share on other sites
Advertisement
Hmm, before this thread gets closed, I have a relevant question.

What would be a good and simple way to approximate (10-30% error is fine) the length of a cubic bezier curve?

Right now, off the top of my head, I''m thinking something like this, where A, B, C, and D are the control points (A and D being the end points).
lcurve = 0.5 * (AB + DC) + AD 
Does that sound at all reasonable? And is there a better way (again, anything under 30% error is fine with me). Thanks!

---
shurcooL`

Share this post


Link to post
Share on other sites
when learning about interpolation, its very usefull to understand how to derive the functions that you use, because if you do, youll be able to obtain the solution to any interpolation you want, which rocks.

the length of the curve cant be determined analiticly im affraid,, but you could set up a function, i suppose the squareroot of aq 6th order polynomal, and solve it numerically.

the easiest way would be to evaluate a couple of points though, and calculate the distances between those. for a point or ten it should give you quite a decent approximation of the length of the curve.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!