If you want to do this kind of things you might try out my library:
http://www.tecn.upf.es/master/mad04/~rmarxer/processing/geomerative/documentation/index.htm
Quite ALPHA yet, but it helps to have people's feedback.
So the way to do it with my library would be:
Code:
import geomerative.*;
RPolygon p, protated, pintersection;
RMatrix m;
int SMALLRAD = 10;
int LARGERAD = 100;
void setup(){
size(300,300);
background(0);
framerate(24);
p = new RPolygon();
p.addPoint(-SMALLRAD,-LARGERAD);
p.addPoint(SMALLRAD,-LARGERAD);
p.addPoint(SMALLRAD,-SMALLRAD);
p.addPoint(LARGERAD,-SMALLRAD);
p.addPoint(LARGERAD,SMALLRAD);
p.addPoint(SMALLRAD,SMALLRAD);
p.addPoint(SMALLRAD,LARGERAD);
p.addPoint(-SMALLRAD,LARGERAD);
p.addPoint(-SMALLRAD,SMALLRAD);
p.addPoint(-LARGERAD,SMALLRAD);
p.addPoint(-LARGERAD,-SMALLRAD);
p.addPoint(-SMALLRAD,-SMALLRAD);
protated = new RPolygon(p);
m = new RMatrix();
m.rotate(PI/120);
}
void draw(){
background(0);
translate(width/2,height/2);
stroke(255);
fill(255);
protated.transform(m);
pintersection = p.intersection(protated);
pintersection.draw(g);
}
Hope it helps!
For any questions or suggestions on the library just contact me.