I wrote an arc() method that might make lives easier

edited June 2016 in Share Your Work

https://www.marginallyclever.com/2016/06/creating-processing-arc-method/

https://github.com/i-make-robots/drawArcs

Designed to closely resemble the gcode G02 an G03 commands. The above sketch includes visualization routines.

void drawArc(float sx,float sy,float ex,float ey,float cx,float cy,boolean cw)

arc starts at (sx,sy) arc ends at (ex,ey) arc center is at (cx,cy) arc direction around center is clockwise if cw=true

start-center does not have to be the same distance as end-center, so sections of ellipses are easy to draw.

I hope you find this useful. Enjoy!

Tagged:

Comments

  • edited June 2016

    Does the job, well done.

    My only other comment is that if the start-center distance is different from the end-center distance then you are drawing a spiral section not an elliptical section.

Sign In or Register to comment.