# How to close a PShape with 2 arcs and two lines

**URL:** <https://discourse.processing.org/t/how-to-close-a-pshape-with-2-arcs-and-two-lines/5287>\
**Category:** Coding Questions\
**Created:** [November 7, 2018, 2:27am UTC](https://discourse.processing.org/t/how-to-close-a-pshape-with-2-arcs-and-two-lines/5287 "2018-11-07T02:27:43Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 11, 2018, 2:07am UTC](https://discourse.processing.org/t/how-to-close-a-pshape-with-2-arcs-and-two-lines/5287/3 "2018-11-11T02:07:49Z")

</div>

good, thanks @jeremydouglass , but doing the outline is only one question,

> [@ddownn](#):
>
> PShape like a segment of a color wheel, but I am not sure how to close it so I can use a stroke, and fills,

how can a group ( of shapes ( even if closed )) be treated like a closed shape and filled??

```auto

PShape l1,l2,l3,l4,all;
int w=100;

void setup(){
 size(300,300); 
 
 all = createShape(GROUP);
 l1 = createShape(LINE,0,0,w,0);
 l2 = createShape(LINE,w,0,w,w);
 l3 = createShape(LINE,w,w,0,w);
 l4 = createShape(LINE,0,w,0,0);
 all.addChild(l1);
 all.addChild(l2);
 all.addChild(l3);
 all.addChild(l4);
 //all.fill(0,200,0); // fill() can only be called between beginShape() and endShape()
}

void draw(){
  background(200,200,0);
  fill(0,200,0); // not change
  //all.setFill(0, 200); // ERROR This renderer does not support setFill() for individual vertices
  shape(all,width/2,height/2);
}

```

i have no idea??

only for a single vertex shape the dynamic fill works for me

```auto
PShape s;

void segment(float in_r,float out_r, float start_p,float stop_p){
  s = createShape();
  s.beginShape();
  float rx,ry;
  for ( float f = start_p ; f < stop_p ; f+=(stop_p-start_p)/360){
  rx = in_r * sin(f);
  ry = in_r * cos(f);  
  s.vertex(rx,ry); 
  }
  rx = in_r * sin(stop_p);
  ry = in_r * cos(stop_p);  
  s.vertex(rx,ry); 
  rx = out_r * sin(stop_p);
  ry = out_r * cos(stop_p);  
  s.vertex(rx,ry); 
  for ( float f = stop_p ; f > start_p ; f-=(stop_p-start_p)/360){
  rx = out_r * sin(f);
  ry = out_r * cos(f);  
  s.vertex(rx,ry); 
  }
  rx = in_r * sin(start_p);
  ry = in_r * cos(start_p);  
  s.vertex(rx,ry); 
  s.endShape(CLOSE); //
}

void setup() {
  size(300, 300,P2D);
  segment(50,90,PI*0.2,PI*1.7);
}

void draw() {
  background(200,200,0);
  shape(s, width/2, height/2);
  s.setFill(color(255-mouseY, mouseX, 255));
// s.setStroke(false);
}

```

---

_[View the full topic](https://discourse.processing.org/t/how-to-close-a-pshape-with-2-arcs-and-two-lines/5287)._
