Split a circle into 28 parts

Hi, I’m trying to split a circle into 28 parts to look something like this:
Unknown
But I can’t do it. Does someone know how to do it?

Use arc(). Maybe in conjunction with a for loop and rotate().

Post your attempt for more help.

I thought arc() was to cut the circle. I just want to split the circle to make each part interactive with the mouse

Ah, in that case you can just draw some lines:

void setup(){
  size(400,400);
}

void draw(){
  background(0);
  ellipse(200,200,360,360);
  pushMatrix();
  translate(200,200);
  for( int i = 0; i<14; i++){
    line(-180,0,180,0);
    rotate(PI/14.0);
  }
  popMatrix();
}
1 Like

Oh, if you want interactions with sections, then it might be better to draw each section by itself.

You would use arc() to draw one sections. Draw 28 of them, and you draw a full circle!

1 Like

Oh you can draw the arcs of different colors (fully filled) on an invisible PGraphics behind your visible image

Then you check the mouse against the color using pg.get( mouseX, mouseY);

arc works just add a bit to the angles

Welcome to the forum!!!

1 Like

I’d do which-arc-is-my-mouse-over detecting with distance and angle from circle center…

2 Likes

Hello,

Get to know the resources available to you.

Resources < Click here to expand !

I encourage you to review the resources available here:

:)

1 Like

how could I do that ?

I have it like this but the circle and the lines are still not interactive. The image rotates but the circle and the lines are still not rotating

How can I do what?

When the image rotate using rotate
include the code section in this rotation section of the code please