Hi, I’m new to processing, and this is my first post. I has some problem with a processing assignment in school, so I hope everyone can help me to see how to approach to this problem.

So basically I want to create a nested polygon pattern.!

I created the outer polygon by connecting random vertices around a circle.

Then I need to find the midpoints between every vertices. The problem is that all my x-coordinates are stored in sx, and all my y-coordinates are stored in sy, so I have no idea how to calculate the midpoints.

Here is my code:

```
int numVertices=int(random(4,10));
float[] sx;
float[] sy;
void setup() {
size(600, 600);
background(255);
noLoop();
}
void draw() {
stroke(0);
noFill();
translate(width/2, height/2); // move to the center of the screen
float angles[] = new float[numVertices];
float radius=250;
for (int i=0; i<numVertices; i++) {
angles[i] = random(TWO_PI);
}
angles = sort(angles);
for (int i = 0; i < 1; i++){
drawPolygon(angles, radius);
}
}
void drawPolygon(float[] angles, float radius){
createShape();
beginShape();
for (int i = 0; i<numVertices; i++){
for (float a : angles) {
float sx = cos(a) * radius;
float sy= sin(a) * radius;
vertex(sx, sy);
}
endShape(CLOSE);
}
}
```