{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

S05DrawingShapes - Cse536 Functional Programming Lecture#5...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Cse536 Functional Programming 1 10/05/15 Lecture #5, Oct 11, 2004 Reading Assignments Finish Chapter 3, Simple Graphics Read Chapter 4, Shapes II, Drawing Shapes Today’s Topics Using the graphics primitives Drawing Primitive Shapes Sierpinski’s Triangle Snow-flake Coordinate Systems Position independent shapes Drawing the Shape Data-type
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Cse536 Functional Programming 2 10/05/15 Turning in Homework In order to facilitate my grading homework I would ask the following Email me a copy of the homework. Include the code right in the body of the email. Put all directions in comments. I will try and run this email, so don’t clutter it with stuff that will make this hard. Put your name and the homework # in the Subject heading. i.e. Subject: Tim Sheard #2 The e-mail is expected to be received before or on the due-date and will be acknowledged if you ask for acknowledgement. The email address to use is: [email protected] You are also expected to turn in a paper copy in class on the due date. This way I don’t have to print it, and I have something to write comments on.
Background image of page 2
Cse536 Functional Programming 3 10/05/15 Drawing Primitive Shapes The Graphics libraries contain primitives for drawing a few primitive shapes. We will build complicated drawing programs from these primitives ellipse :: Point -> Point -> Draw () shearEllipse :: Point -> Point -> Point -> Draw () line :: Point -> Point -> Draw () polygon :: [Point] -> Draw () polyline :: [Point] -> Draw ()
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Cse536 Functional Programming 4 10/05/15 Coordinate Systems (0,0) Increasing x-axis I n c r e a s i n g y - a x i s
Background image of page 4
Cse536 Functional Programming 5 10/05/15 Example Program main2 = runGraphics( do { w <- openWindow "Draw some shapes" (300,300) ; drawInWindow w (ellipse (0,0) (50,50)) ; drawInWindow w (shearEllipse (0,60) (100,120) (150,200)) ; drawInWindow w (withColor Red (line (200,200) (299,275))) ; drawInWindow w (polygon [(100,100),(150,100),(160,200)]) ; drawInWindow w (withColor Green (polyline [(100,200),(150,200), (160,299),(100,200)])) ; spaceClose w } )
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Cse536 Functional Programming 6 10/05/15 The Result ; drawInWindow w (ellipse (0,0) (50,50)) ; drawInWindow w (shearEllipse (0,60) (100,120) (150,200)) ; drawInWindow w (withColor Red (line (200,200) (299,275))) ; drawInWindow w (polygon [(100,100), (150,100), (160,200)]) ; drawInWindow w (withColor Green (polyline [(100,200),(150,200), (160,299),(100,200)]))
Background image of page 6
Cse536 Functional Programming 7 10/05/15 Building Programs We’d like to build bigger things from these small pieces Perhaps things such as fractals Example: Sierpinski’s Triangle a repeated drawing of a triangle at repeatedly smaller sizes.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}