I’ve been trying to make a 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, and move them around on the screen easily.
I don’t know whether I should try to find a way to calculate the pixels of the other end of the two arcs, it seems like mathematically I’m not going to be able to close the loop properly.
In this example, I have drawn the desired shape twice, and tried to create a PShape to match a single segment.
Can someone please tell me how to do this?
PShape outline, arc1, arc2, line1, line2;
void setup() {
size(800, 480);
outline = createShape(GROUP);
arc1 = createShape(ARC, 0, 0, 460, 460, 0, radians(30), OPEN);
arc2 = createShape(ARC, 0, 0, 115, 115, 0, radians(30), OPEN);
line1 = createShape(LINE, 57.5, 0, 230, 0);
outline.addChild(arc1);
outline.addChild(arc2);
outline.addChild(line1);
}
void draw() {
background(50);
pushMatrix();
translate(width/2, height/2);
shape(outline);
popMatrix();
pushMatrix();
translate(width/2, height/2);
rotate(radians(-105));
noFill();
arc(0, 0, 460, 460, 0, radians(30));
arc(0, 0, 115, 115, 0, radians(30));
line(57.5, 0, 230, 0);
pushMatrix();
rotate(radians(30));
line(57.5, 0, 230, 0);
popMatrix();
popMatrix();
pushMatrix();
translate(width/2, height/2);
rotate(radians(-135));
noFill();
arc(0, 0, 460, 460, 0, radians(30), OPEN);
arc(0, 0, 115, 115, 0, radians(30), OPEN);
line(57.5, 0, 230, 0);
pushMatrix();
rotate(radians(30));
line(57.5, 0, 230, 0);
popMatrix();
popMatrix();
}