help with arc class

Hi, I’m fairly new to Codea and I was hoping that someone could help me with this, I’m trying to create a clas for creating arcs, and this is as far as I have gotten.
Please help


function Geometry:arc(x,y,r,d,a)
    -- Codea does not automatically call this method
    pushMatrix()
    rotate(d,x,y)
    pushMatrix()
    rotate(d/2,x,y)
    clip(x,y,r,r)
    popMatrix()
    pushMatrix()
    rotate(-d/2,x,y)
    clip(x,y,-r,r)
    popMatrix()
    ellipse(x,y,r,r)
    clip()
    popMatrix()
end

@GJD7777 When you post code, put 3 ~'s on a line before and after your code to format it correctly. I added them to your code. Code for arcs have been done already. Try a forum search and see what you find.

Thank you dave1707

This has been discused a few times in the forums. I wrote a simple Arc class and it is available in this post:

http://codea.io/talk/discussion/5894/how-to-improve-arc-calculation-for-pie-fractions-drawing/p1

But if you search the forums for Arc, you’ll find other examples and approaches, to choose from.