//Shipra Gupta //27 feb 2008 //Processing, Shape3 //Create a function for drawing a chair. Use two parameters to change //its position and two more to change the shape. Using your function, //draw 9 chairs in the display window in a regular 3 * 3 matrix. //Use different parameters to give each chair drawn a unique shape. void setup(){ size(360, 450); background(224); } void draw(){ chair(10, 10, 10, 20, #E82F2F); chair(130, 10, 30, 10,#E82F7F); chair(250, 10, 50, 0, #E82FC6); chair(10, 150, 60, 50, #A62FE8); chair(150, 150, 10, 50, #652FE8); chair(250, 150, 30, 50, #2F55E8); chair(10, 300, 5, 50, #2FA8E8); chair(80, 300, 60, 30, #2FE8C1); chair(210, 320, 80, 10, #2FE858); } void chair (int x, int y, int back, int legs, int colour){ fill(colour); //chair body beginShape(); vertex(x, y); vertex(x+back, y-10); vertex(x+back, y+60); vertex(x+back+60, y+80); vertex(x+60, y+100); vertex(x, y+80); endShape(CLOSE); //line between back and seat line(x, y+80, x+back, y+60); //chair legs line(x, y+80, x, y+80+legs); line(x+60, y+100, x+60, y+100+legs); line(x+back, y+60, x+back, y+60+legs); line(x+back+60, y+80, x+back+60, y+80+legs); }