diff options
author | siddharth ravikumar <s@ricketyspace.net> | 2022-06-29 18:38:50 -0400 |
---|---|---|
committer | siddharth ravikumar <s@ricketyspace.net> | 2022-06-29 18:38:50 -0400 |
commit | e994669de932a464fa01bcfcf30a09b6b742436d (patch) | |
tree | 6648a1e0876cecb7ca60ee9ed670371cee61ccfa /ex | |
parent | 9dfe891335881717fb06e20707389464c82b05d3 (diff) |
ex: 51.rkt: implement `below`
Diffstat (limited to 'ex')
-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))))) |