Underlap and overlap

Hello @Ernest,

Consider using PGraphics to achieve this:

image

I am sharing some of the code for one half as an example.
You can complete the rest.

PGraphics pg2;

void setup() {
  size(400, 400);
  pg2 = createGraphics(400, 400);
  noLoop();
}

void draw() {
  background(220);
  int numCircles = 6;
  float radius = 100;
  float centerX = width/2;
  float centerY = height/2;

  pg2.beginDraw();
  for (int i = 0; i < numCircles; i++) {
    float angle = TWO_PI / numCircles * i - TAU/2;
    float x = centerX + cos(angle) * radius;
    float y = centerY + sin(angle) * radius;
    pg2.strokeWeight(3);
    pg2.fill(0, 255, 0);
    pg2.ellipse(x, y, 150, 150);
  }
  pg2.endDraw();
  
  PImage img2 = pg2.get(200, 0, 200, 400);
  image(img2, 200, 0 );
}

image

:)

1 Like