Browse Source

Resolved 2.49

master
parent
commit
eb47c0f17b
  1. 34
      2.49.scm
  2. 3
      imagelib.scm

34
2.49.scm

@ -8,3 +8,37 @@
d. The wave painter.")
; Exercise start
(define (outline-frame f)
((segments->painter
(list (make-segment origin yunit)
(make-segment yunit one-one)
(make-segment one-one xunit)
(make-segment xunit origin))) f))
(define (draw-X f)
((segments->painter
(list (make-segment origin one-one)
(make-segment xunit yunit))) f))
(define (mid-point A B) (scale-vect .5 (add-vect A B)))
(define (diamond f)
((segments->painter
(list
(make-segment (make-vect .5 0) (make-vect 1 .5))
(make-segment (make-vect 1 .5) (make-vect .5 1))
(make-segment (make-vect .5 1) (make-vect 0 .5))
(make-segment (make-vect 0 .5) (make-vect .5 0)))) f))
; I won't do the wave painter, I have no data
(define frame (make-frame origin (scale-vect 2 xunit) yunit))
(print "-- draw-line test --")
(draw-line origin one-one)
(print "-- segments->painter test --")
(segments->painter (list (make-vect origin one-one) (make-vect half-half one-one)))
(print "-- Outline frame --")
(outline-frame frame)
(print "-- X frame --")
(draw-X frame)
(print "-- diamond --")
(diamond frame)

3
imagelib.scm

@ -45,6 +45,9 @@
(scale-vect (ycor-vect v)
(edge2-frame frame))))))
(define (draw-line p1 p2)
(display "Draw: ")(display p1)(display " -> ")(display p2)(newline))
(define (segments->painter segment-list)
(lambda (frame)
(for-each

Loading…
Cancel
Save