2.49 Exercise 2.49
These procedures are victims to creeping indentation due to the nested lets, but we don’t have the tools to do better at the moment.
As a note: The painter considers the upper bound of 1.0 to not be inside the image – that is, points at an X or Y coordinate of 1.0 will not be drawn. To get the semantics we want, we define an upper-bound that can be drawn:
(define upper-bound 0.995)
(define bottom-left (make-vect 0.0 0.0)) (define bottom-right (make-vect upper-bound 0.0)) (define top-left (make-vect 0.0 upper-bound)) (define top-right (make-vect upper-bound upper-bound))
Next, an outline painter:
(define outline-painter (let ((bottom (make-segment bottom-left bottom-right)) (left (make-segment bottom-left top-left)) (right (make-segment bottom-right top-right)) (top (make-segment top-left top-right))) (segments->painter (list bottom left right top))))

Next, an "X" painter:
(define x-painter (segments->painter (list (make-segment bottom-left top-right) (make-segment top-left bottom-right))))

These two procedures could be generalized to be applications of a procedure creating painters working on the corners of a frame.
A painter for a diamond whose corners are the midpoints of the frame (using hardcoded midpoints because we are working on the unit frame):
(define diamond-painter (let ((bottom (make-vect 0.5 0.0)) (left (make-vect 0.0 0.5)) (right (make-vect upper-bound 0.5)) (top (make-vect 0.5 upper-bound))) (let ((bottom-left (make-segment bottom left)) (left-top (make-segment left top)) (top-right (make-segment top right)) (right-bottom (make-segment right bottom))) (segments->painter (list bottom-left left-top top-right right-bottom)))))

Defining wave is simply a matter of supplying segments->painter with a more complex list of segments. I don’t think the amount to be learned here is worth the work it takes to find these edges based on the images in the book.