diff options
-rw-r--r-- | ex/2/49.rkt | 3 | ||||
-rw-r--r-- | ex/2/50.rkt | 2 | ||||
-rw-r--r-- | ex/2/51.rkt | 45 |
3 files changed, 49 insertions, 1 deletions
diff --git a/ex/2/49.rkt b/ex/2/49.rkt index 989f36d..b231318 100644 --- a/ex/2/49.rkt +++ b/ex/2/49.rkt @@ -5,7 +5,8 @@ (provide frame-coord-map paint - wave->painter) + wave->painter + x->painter) (require racket/draw) (require racket/snip) diff --git a/ex/2/50.rkt b/ex/2/50.rkt index a4f2433..3a67578 100644 --- a/ex/2/50.rkt +++ b/ex/2/50.rkt @@ -2,6 +2,8 @@ #lang racket +(provide transform-painter) + (require "46.rkt") (require "47.rkt") (require "49.rkt") diff --git a/ex/2/51.rkt b/ex/2/51.rkt new file mode 100644 index 0000000..975c064 --- /dev/null +++ b/ex/2/51.rkt @@ -0,0 +1,45 @@ +;;;; License: CC0-1.0 + +#lang racket + +(require "46.rkt") +(require "49.rkt") +(require "50.rkt") + + +(define (beside painter1 painter2) + (let ((split-point (make-vect 0.5 0.0))) + (let ((paint-left + (transform-painter + painter1 + (make-vect 0.0 0.0) + split-point + (make-vect 0.0 1.0))) + (paint-right + (transform-painter + painter2 + split-point + (make-vect 1.0 0.0) + (make-vect 0.5 1.0)))) + (lambda (frame) + (paint-left frame) + (paint-right frame))))) + + +(define (below painter1 painter2) + (let ((split-point (make-vect 0.0 0.5))) + (let ((paint-above + (transform-painter + painter2 + (make-vect 0.0 0.0) + (make-vect 1.0 0.0) + split-point)) + (paint-below + (transform-painter + painter1 + split-point + (make-vect 1.0 0.5) + (make-vect 0.0 1.0)))) + (lambda (frame) + (paint-above frame) + (paint-below frame))))) |