how to draw Arcs?

Hi,

I have some developing experience with games on iOS using standard Apple frameworks but I’m totally new to Corona SDK and I’m a bit confused right now because I can’t find a way do draw an ordinary arc: I have found the display.newCircle() method but it draws a full circle while I need a way to draw only a part of it. 

I found some tips about how to draw a bezier curve actually using the newLine() method and appending points to it but I just need an ordinary Arc, not a Bezier curve, and I’m puzzled that there isn’t a simple method to do that… Or I just can’t find it.

In the game I’m developing I’ll have to deal with a lot of procedural graphics, mostly lines and arcs so I’m worried about having to draw many arcs by appending so many short lines.

Isn’t there a simplier way to draw arcs?

thanks!

This has been asked a few times.  You can find the various answers by googling “site: coronalabs.com draw arc”

Horacebury supplies some code here: https://forums.coronalabs.com/topic/47809-how-to-draw-an-arc-shaped/

Also, here is some code from the SSK Legacy archive (Credit for this specific code goes to rmbsoft):

http://github.com/roaminggamer/SSKLegacy/blob/master/ssk/display/arcs.lua

Also, I failed to say.  No.  There is no way to draw an arc except as line-segments.  There is no native ‘arc’ display object.

Hi.

The short lines thing (as in the above links) isn’t necessarily a big deal, as it will basically just build up a mesh, which a dedicated arc shape almost certainly would as well.

That said, I’ve been (slooooowly) working on some geometry articles and cobbling together figures to go along with them, with quite a lot of arcs involved. With that mind I have a crude library to make the figures. If it’s helpful, the arc logic is mostly self-contained here (an arc class) and here (the underlying shader, which clips a circle’s stroke). The code has been for my own use, so the “documentation” would just be the stuff in the subdirectories (especially “Circles” or “Centers”).

There’s a minor dependency on roaminggamer’s math2d in the arc class code, though in this case it’s just to compute a simple length and for a function that you probably don’t need anyway (revolves a triangle around one of its vertices, tracing an arc with one of the others).

This has been asked a few times.  You can find the various answers by googling “site: coronalabs.com draw arc”

Horacebury supplies some code here: https://forums.coronalabs.com/topic/47809-how-to-draw-an-arc-shaped/

Also, here is some code from the SSK Legacy archive (Credit for this specific code goes to rmbsoft):

http://github.com/roaminggamer/SSKLegacy/blob/master/ssk/display/arcs.lua

Also, I failed to say.  No.  There is no way to draw an arc except as line-segments.  There is no native ‘arc’ display object.

Hi.

The short lines thing (as in the above links) isn’t necessarily a big deal, as it will basically just build up a mesh, which a dedicated arc shape almost certainly would as well.

That said, I’ve been (slooooowly) working on some geometry articles and cobbling together figures to go along with them, with quite a lot of arcs involved. With that mind I have a crude library to make the figures. If it’s helpful, the arc logic is mostly self-contained here (an arc class) and here (the underlying shader, which clips a circle’s stroke). The code has been for my own use, so the “documentation” would just be the stuff in the subdirectories (especially “Circles” or “Centers”).

There’s a minor dependency on roaminggamer’s math2d in the arc class code, though in this case it’s just to compute a simple length and for a function that you probably don’t need anyway (revolves a triangle around one of its vertices, tracing an arc with one of the others).