wonderburg7
9/16/2018 - 12:22 PM

Diff Shapes in shapes

void setup() {
  size(4000, 4000);
  background(102);
//    background(0);

  strokeWeight(12);
}

void draw() {  
  pushMatrix();
  polygon(4000/2, 4000/2, 1800, 7);  // Heptagon
  popMatrix();
  
  pushMatrix();
  polygon(4000/2, 4000/2, 1800, 6);  // Heptagon
  popMatrix();
  
  pushMatrix();
  polygon(4000/2, 4000/2, 1800, 5);  // Triangle
  popMatrix();
  
  pushMatrix();
  polygon(4000/2, 4000/2, 1800, 4);  // Icosahedron
  popMatrix();
  
  pushMatrix();
  polygon(4000/2, 4000/2, 1800, 3);  // Heptagon
  popMatrix();
  
    save("shapesinshapes1.png");
}


void polygon(float x, float y, float radius, int npoints) {
  float angle = TWO_PI / npoints;
  beginShape();
  for (float a = 0; a < TWO_PI; a += angle) {
    float sx = x + cos(a) * radius;
    float sy = y + sin(a) * radius;
    vertex(sx, sy);
  }
  endShape(CLOSE);
}