Excuse my messy code!

The idea is that I generate the sectioned circle as above and then fill each section with an alternating fill, leftFill & rightFill. Which are PShape objects made up of many diagonal lines with varying spacing.

I had hoped that .intersect() would allow me to make a masked PShape object to apply rightFill & leftFill to the main sectioned circle shape. Although I’m guessing that I’m getting my use cases mixed up…

```
import processing.svg.*;
import micycle.pgs.*;
void setup() {
size(420, 594);
background(255);
noLoop();
noFill();
beginRecord(SVG, "sectionedCircle.svg");
}
PShape createLineFills(float a, float maxspacing) {
float spacing = maxspacing;
PShape line = createShape();
line.beginShape(LINES);
for (float x=-height; x<=height; x+=spacing) {
line.vertex(x, -height);
line.vertex(x, height);
spacing = map(noise(x*0.01), 0, 1, 0, maxspacing);
}
line.endShape();
line.rotate(a);
return line;
}
float sagitta(float r, float s) {
return sqrt(2*s*r-s*s);
}
void drawSectionedLinedCircle(float x, float y, float r, int n) {
translate(x, y);
float rInc = (2*r)/n;
float s = rInc;
float a1 = 0;
float a2 = asin(sagitta(r, s)/r);
float maxShift = 100;
float scale = 0.15;
PShape leftFill = createLineFills(QUARTER_PI, 50);
PShape rightFill = createLineFills(-QUARTER_PI, 50);
PShape fill;
while (a2<=PI) {
for (float i=0; i<n; i++) {
pushMatrix();
translate(0, map(noise(i*scale), 0, 1, -maxShift, maxShift));
PShape section = createShape();
section.beginShape();
for (float a=a1; a<=a2; a+=radians(0.5)) {
section.vertex(r*cos(a), r*sin(a));
}
for (float a=a2; a>=a1; a-=radians(0.5)) {
section.vertex(r*cos(-a), r*sin(-a));
}
section.endShape(CLOSE);
a1 = a2;
s += rInc;
a2 = asin(sagitta(r, s)/r);
if (s>=r)
a2 += 2*(HALF_PI-a2);
//println(degrees(a2));
shape(section);
if (i%2==0) {
fill = PGS_ShapeBoolean.intersect(section, leftFill);
} else {
fill = PGS_ShapeBoolean.intersect(section, rightFill);
}
PGS_Conversion.setAllStrokeColor(fill, 150, 2);
shape(fill);
popMatrix();
}
}
}
void draw() {
drawSectionedLinedCircle(width/2, height/2, width/2, 9);
endRecord();
}
```