8.14

Lecture 24: Measuring and drawing curves🔗

This assignment is due on Tuesday, November 12 at 11:59pm. Submit it using Handin as assignment lecture24.

; 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 Lab 8: Turtle graphics.

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.