``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72``` ```# Fall 2017 PS02 Task1b # Lois Reasoner's debugGraphics.py from cs1graphics import * from graphicsState import * # Useful for debugging. See Lec 03 Notebook from cs1graphicsHelper import * # Useful for debugging. See Lec 03 Notebook #------------------------------------------------------------------------------- # Create the "world" that holds the faces world = Canvas(800, 600, 'bisque', 'Faces') # A face = a Layer that will have a head, eyes/browse, nose, and mouth # The reference point of the face is at its center. face = Layer() world.add(face) # The head is the rectangular base for holding eyes/browe, nose, and mouth head = Rectangle(200,160) face.add(head) head.setFillColor('salmon') # rightEyeAndBrow combines right eye and brow into a single cloneable unit rightEyeAndBrow = Layer() face.add(rightEyeAndBrow) # eye of right eye/brow unit eye = Ellipse(15,30,Point(50,0)) rightEyeAndBrow.add(eye) eye.setFillColor('white') # brow of right eye/brow unit brow = Path(Point(45, -25), Point(65,-15)) rightEyeAndBrow.add(brow) brow.setBorderWidth(3) # Thicken brow rightEyeAndBrow.move(0,-25) # Position right eye/brow unit # left eye/brow is transformed clone of right leftEyeAndBrow = rightEyeAndBrow.clone() leftEyeAndBrow.rotate(180) face.add(leftEyeAndBrow) # nose is a path with two lines nose = Path(Point(0,-15), Point(20,15), Point(0,15)) face.add(nose) # mouth is a filled asymmetric triangular polygon mouth = Polygon(Point(-50,35), Point(10,60), Point(50,35)) world.add(mouth) mouth.setFillColor('red') # Move initial face to upper left corner face.moveTo(100,80) # face2 is transformed face in lower left corner face2 = face.clone() face2.rotate(-90) face2.moveTo(0, 600) world.add(face2) # face3 is transformed face in uppper right corner face3 = face.clone() face3.rotate(-90) face3.scale(0.8) face3.moveTo(80,736) world.add(face3) # face4 is transformed face in lower right corner face4 = face.clone() face4.scale(1.5) face4.rotate(-45) face4.moveTo(600,400) ```