// Class Example: How to draw a 4 leaf clover
   // First we define, and test a petal() function
   // Next, we deine a flower() function that draws 4 petals.
   // Try varying the alpha values of color and changing N in flower()
   // Try changing the shape of the petal
   // Modify sketch so it draws a flower of random size
   // where mouse is clicked.
   // Can  you modify the program so it spins??
void setup() {
   size(500, 500);
   background(255);
   noLoop();
   } // setup()
void draw() {
 fill(0, 158, 96);  // This is Shamrock Green
   noStroke();
   flower(width/2, height/2, 100);
} // draw()
 
void flower(int x, int y, int s) {
   // Draws a flower with N petals
   
   int N = 4;
   float theta = TWO_PI/N;
   pushMatrix();
   translate(x, y);
   for (int i = 1; i <= N; i++) {
   rotate(theta);
   petal(0, 0, s/2, s/2);
   }
   popMatrix();
   } // flower()
void petal(int x, int y, int w, int h) {
   // Draws a petal
   
   pushMatrix();
   translate(x, y);
   beginShape();  // The petal
   curveVertex(0, 0);
   curveVertex(0, 0);
 curveVertex(w/4, -h);
   curveVertex(w, -h/2);
   //curveVertex(0, 0);
 curveVertex(0, 0);
   curveVertex(0, 0);
   endShape(CLOSE);
   popMatrix();
   } // petal()