I'm relatively new to Processing, so apologies if this question is odd or covered elsewhere. I've spent the last couple of days going over the forums and API docs, and haven't found my answer yet.
Basically I'd like to create two irregular toroid objects based on some computed data array, where features of the "bottom" one can show through the middle of the "top" one. Think of a small donut stacked under a big donut: I want to be able to see the features of the bottom donut through the top donut's hole. Currently I have (in pseudocode):
float x, y;
beginShape();
for (int i = 0; i < ptsInCircle; i++){
//...compute r, theta...
x = r*cos(theta);
y = r*sin(theta);
curveVertex(x,y);
}
endShape();
int torWidth = 10;
fill(bgColor);
for (int i = 0; i < ptsInCircle; i++){
//...compute r, theta...
x = (r-torWidth)*cos(theta);
y = (r-torWidth)*sin(theta);
curveVertex(x,y);
}
endShape();
This succeeds in creating a single object that has the illusion of a hole in the middle, because it's been filled with the background color (here - bgColor). However, when I draw two such objects (really 4 drawings total), the features of the bottommost object get masked by the top. Is there a way to effectively erase the center so that the lower level drawings will show through? I played a bit with drawing each as a separate PGraphics object, but this still didn't help erase the center of the shape.