Hi jirko,
I've been playing around with the arc() function as well. If you're interested you can read a blogpost I wrote about it here. It might show you some of the possibilities of arc().
http://amnonp5.wordpress.com/2010/05/08/the-beauty-of-arcsI have two tips for you:
1. Use
radians() with degrees instead of PI-values. I think it's a lot easier.
2. I think using a
FOR loop here is probably easier than an array.
Here is some code to show what I mean by these two suggestions.
Code:int segments = 4;
void setup() {
size(500,500);
smooth();
}
void draw() {
background(255);
noFill();
strokeWeight(15);
strokeCap(SQUARE);
translate(width/2,height/2);
// using the radians() function means you can use 360 degrees,
// which simplifies the math a lot
stroke(0);
arc(10, 10, 100, 100, radians(0), radians(90));
arc(-10, 10, 100, 100, radians(90), radians(180));
arc(-10, -10, 100, 100, radians(180), radians(270));
arc(10, -10, 100, 100, radians(270), radians(360));
// using a FOR loop makes it easier to draw a number of
// similar shapes like this one
for (int i=0; i<segments; i++) {
stroke(i*100,255-i*50,0);
arc(0, 0, 200, 200, radians(i*90), radians((i+1)*90));
}
}
Now perhaps you could play around with the segments value and change some of the arc-math accordingly to make it all work the way you want to. Good luck!