# Split a circle into 28 parts

**URL:** https://discourse.processing.org/t/split-a-circle-into-28-parts/20650
**Category:** Coding Questions
**Tags:** homework
**Created:** [May 8, 2020, 9:02pm UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650 "2020-05-08T21:02:38Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![matildespinheiro](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@matildespinheiro](https://discourse.processing.org/u/matildespinheiro)
#### Post date: [May 8, 2020, 9:02pm UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/1 "2020-05-08T21:02:38Z")

</div>

Hi, I’m trying to split a circle into 28 parts to look something like this:  
 ![Unknown](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/6c87d2cf58dcbd2ab673ea5546313925685381a8.jpeg)  
But I can’t do it. Does someone know how to do it?

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [May 8, 2020, 9:27pm UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/2 "2020-05-08T21:27:46Z")

</div>

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

Post your attempt for more help.

---

<div class="post-metadata">

### Author: ![matildespinheiro](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@matildespinheiro](https://discourse.processing.org/u/matildespinheiro)
#### Post date: [May 8, 2020, 10:52pm UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/3 "2020-05-08T22:52:57Z")

</div>

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

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [May 9, 2020, 1:49am UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/4 "2020-05-09T01:49:36Z")

</div>

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

```auto
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();
}

```

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [May 9, 2020, 1:53am UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/5 "2020-05-09T01:53:25Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [May 9, 2020, 6:12am UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/6 "2020-05-09T06:12:32Z")

</div>

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!!!

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [May 9, 2020, 7:33am UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/7 "2020-05-09T07:33:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [May 9, 2020, 11:37am UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/8 "2020-05-09T11:37:21Z")

</div>

Hello,

Get to know the resources available to you.

> **Resources \< Click here to expand !**
>
> I encourage you to review the resources available here:
> 
> - The Processing website has references, examples, tutorials, etc.  
> [https://processing.org/](https://processing.org/)
> - Those available with the Processing PDE (IDE).  
> An exploration of the tabs will reveal what is available; there are libraries and examples there.
> - The Coding Train  
> [https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1\_aw](https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw)  
> [https://thecodingtrain.com/](https://thecodingtrain.com/)
> - Happy Coding  
> [Processing Tutorials - Happy Coding](https://happycoding.io/tutorials/processing/)
> - The Processing Foundation  
> [https://processingfoundation.org/](https://processingfoundation.org/)  
> Check out the tabs.  
> In the education tab, there is a reference to the Coding Train.

`:)`

---

<div class="post-metadata">

### Author: ![matildespinheiro](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@matildespinheiro](https://discourse.processing.org/u/matildespinheiro)
#### Post date: [May 9, 2020, 6:12pm UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/9 "2020-05-09T18:12:43Z")

</div>

how could I do that ?

---

<div class="post-metadata">

### Author: ![matildespinheiro](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@matildespinheiro](https://discourse.processing.org/u/matildespinheiro)
#### Post date: [May 9, 2020, 6:14pm UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/10 "2020-05-09T18:14:57Z")

</div>

![Screenshot 2020-05-09 at 19.13.06](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c6901831ab345ea8a3f61fe66f278d32f6003e36.jpeg)

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

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [May 9, 2020, 7:38pm UTC](https://discourse.processing.org/t/split-a-circle-into-28-parts/20650/11 "2020-05-09T19:38:34Z")

</div>

How can I do what?

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