Efficiently draw a Bezier curve

Dear all,

I’ve searched but nothing comes really handy. I’d like to draw a Bezier curve, or another kind of curved path for what it’s worth.

What is the best way of producing curved paths?

My solution is not efficient.

Right now I am creating a newPolygon with a discretization of the Bezier curve, but it’s ugly if the number of points is low, and probably not worth if I make a 1000 points polygon. I’d like to have the quality of a newCircle, if possible.

Thank you!

Here are some links for you.  Some of the links have sample code.  One of these should be helpful for you.

https://gist.github.com/neostar20/3940354

https://code.coronalabs.com/code/object-moving-along-bezier-curve-example

http://www.renderedmouse.com/projects/44/coaster-thrills/corona-sdk-and-bezier-curves/

http://www.carlosicaza.com/2011/01/03/bezier-curve-fitting-in-corona-sdk/

* this last one is from Carlos Icaza, one of the original creators of Corona

Best of luck!

Bob

I did a quick search (corona draw curved path) and found these links (some overlap with above response).

Not sure if they will help, and some may be a bit old, but maybe they will get you started.

(2011 … oldest and from Carlos) http://www.carlosicaza.com/2011/01/03/bezier-curve-fitting-in-corona-sdk/

(2012 may require modification) https://github.com/neostar20/Bezier-Curve-for-Corona-SDK/tree/master/Examples/Three%20Curves

(2012 and just the algorithm for a bezier curve) https://github.com/neostar20/Bezier-Curve-for-Corona-SDK/blob/master/bezier.lua

( 2014 an article here! ) https://coronalabs.com/blog/2014/09/09/tutorial-working-with-curved-paths/

Don’t miss the code links at bottom of article.

Tip: If you click this link and get a blank search page, close the page and click the link again.  I’ve found that sometimes when you follow links (for the first time) to the corona code-vault, they re-direct to the search page.

I can’t consistently reproduce this, but sometimes it happens to me.

RoamingGamer,

I did notice same thing.  It happens occasionally; then on a subsequent click it does gets to the link.  Not a clue as to why.

Thanks

Bob

Here are some links for you.  Some of the links have sample code.  One of these should be helpful for you.

https://gist.github.com/neostar20/3940354

https://code.coronalabs.com/code/object-moving-along-bezier-curve-example

http://www.renderedmouse.com/projects/44/coaster-thrills/corona-sdk-and-bezier-curves/

http://www.carlosicaza.com/2011/01/03/bezier-curve-fitting-in-corona-sdk/

* this last one is from Carlos Icaza, one of the original creators of Corona

Best of luck!

Bob

I did a quick search (corona draw curved path) and found these links (some overlap with above response).

Not sure if they will help, and some may be a bit old, but maybe they will get you started.

(2011 … oldest and from Carlos) http://www.carlosicaza.com/2011/01/03/bezier-curve-fitting-in-corona-sdk/

(2012 may require modification) https://github.com/neostar20/Bezier-Curve-for-Corona-SDK/tree/master/Examples/Three%20Curves

(2012 and just the algorithm for a bezier curve) https://github.com/neostar20/Bezier-Curve-for-Corona-SDK/blob/master/bezier.lua

( 2014 an article here! ) https://coronalabs.com/blog/2014/09/09/tutorial-working-with-curved-paths/

Don’t miss the code links at bottom of article.

Tip: If you click this link and get a blank search page, close the page and click the link again.  I’ve found that sometimes when you follow links (for the first time) to the corona code-vault, they re-direct to the search page.

I can’t consistently reproduce this, but sometimes it happens to me.

RoamingGamer,

I did notice same thing.  It happens occasionally; then on a subsequent click it does gets to the link.  Not a clue as to why.

Thanks

Bob