We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I need to create a polygon on 9 points, the only way ive figured out how to do this is by using the beginShape , vertex(x,y) and endShape. I havent been taught these functions in class so i dont want to use them to create this polygon. is there a way to do this with just a forloop and lines?
code i have so far
int points = 9;
float centerX,centerY;
float radius = 100;
void setup(){
size(500,500);
centerX = width/2; centerY = height/2;
} void draw(){
background(200);
float angle = TWO_PI / points;
for( int i = 0 ; i < points ; i ++ ){
float posX = centerX + cos(i*angle) * radius;
float posY = centerY + sin(i*angle) * radius;
}
}
Answers
https://Forum.Processing.org/two/discussion/15064/how-to-avoid-crossing-borders-in-a-random-polygon#Item_12