summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-06-29 18:38:50 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-06-29 18:38:50 -0400
commite994669de932a464fa01bcfcf30a09b6b742436d (patch)
tree6648a1e0876cecb7ca60ee9ed670371cee61ccfa
parent9dfe891335881717fb06e20707389464c82b05d3 (diff)
ex: 51.rkt: implement `below`
-rw-r--r--ex/2/49.rkt3
-rw-r--r--ex/2/50.rkt2
-rw-r--r--ex/2/51.rkt45
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)))))