|
Author |
Topic: circular arcs (Read 729 times) |
|
REAS
|
Re: circular arcs
« Reply #1 on: Dec 4th, 2002, 8:50pm » |
|
hello ed, this is not the best way but it's one way and i think it is clear. in this code, you specify the beginning and end points of the arc using degree values (0-360). Code: void setup() { size(300, 300); } void loop() { arc_degrees(width/2, height/2, 0, 270, 100); } void arc_degrees(int x, int y, int begin, int end, int radius) { if (begin > end) { int temp = begin; begin = end; end = temp; } beginShape(LINE_STRIP); for(int i=begin; i<=end; i++) { float xval = radians(i); float yval = radians(i); vertex(x + cos(xval)*radius, y - sin(yval)*radius); } endShape(); } |
|
|
« Last Edit: Dec 4th, 2002, 11:20pm by REAS » |
|
|
|
|
|