8.12

Lecture 24: Measuring and drawing curves🔗

Due to the solar eclipse, we will skip this lecture. On Wed Apr 3 at 9:45am, come to IF (Luddy Hall) room 0119 to get help on Problem set 10: Prefix trees due that day.

; A CurveTree is one of:
; - (make-segment Posn Posn)
; - (make-connect CurveTree CurveTree)
(define-struct segment [p1 p2])
(define-struct connect [c1 c2])

Exercise 1. Write the template for processing a CurveTree. Make it look like a function called process-curve-tree, and do not put it in a comment.

Exercise 2. Design the function draw-curve-tree. It should take a CurveTree and an Image, and draw the CurveTree on the Image, producing an Image. The scene+line function will be useful; you used it in Problem set 7: Lists.

For the rest of this page, you don’t need to submit anything, but do watch the videos and try the exercises anyway. We’ll work through similar material together in class.

Exercise 3. Create an image, plotting the quarter-circle function seen in the video.

The code written in the videos above is available for your reference. To download it, don’t use “Save Page As” or “Save As”; use “Save Link As” or “Download Linked File” in your Web browser. If you can’t find the command, try right-clicking or two-finger-tapping or long-pressing.