Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [GDK] - Bezier Curve

Author
Message
xCatalyst
11
Years of Service
User Offline
Joined: 5th Dec 2012
Location: Pittsburgh, PA
Posted: 10th Feb 2013 18:30 Edited at: 10th Feb 2013 18:31
I've spent the past couple days here working on a bezier curve function that is easy to use and fast. I'm not sure how this compares to other functions speed-wise, but it is simple to use, so that's a success.

Preview Image:


How It Works:


Lines are casted along opposite control lines from the end points of the starting line and where corresponding lines intersect (1 to 1, 2 to 2, 3 to 3, etc.) is where a point is plotted. Points can be added/removed dynamically because it was created using vectors, and I tried to make the code as easy to read as I possibly could. Also, I get to about a 1000 vertices before taking some lag, but, let's face it, it'll look smooth with 20.

Anyway, the code:


Let me know how it works for you guys, thanks

Login to post a reply

Server time is: 2024-02-22 16:37:17
Your offset time is: 2024-02-22 16:37:17