diff options
Diffstat (limited to 'ex/2')
-rw-r--r-- | ex/2/49.rkt | 5 | ||||
-rw-r--r-- | ex/2/50.rkt | 29 |
2 files changed, 34 insertions, 0 deletions
diff --git a/ex/2/49.rkt b/ex/2/49.rkt index 601d17c..989f36d 100644 --- a/ex/2/49.rkt +++ b/ex/2/49.rkt @@ -2,6 +2,11 @@ #lang racket +(provide + frame-coord-map + paint + wave->painter) + (require racket/draw) (require racket/snip) diff --git a/ex/2/50.rkt b/ex/2/50.rkt new file mode 100644 index 0000000..d2b91a6 --- /dev/null +++ b/ex/2/50.rkt @@ -0,0 +1,29 @@ +;;;; License: CC0-1.0 + +#lang racket + +(require "46.rkt") +(require "47.rkt") +(require "49.rkt") + + +(define (transform-painter painter origin corner1 corner2) + (lambda (frame) + (let ((m (frame-coord-map frame))) + (let ((new-origin (m origin))) + (painter (make-frame + new-origin + (sub-vect (m corner1) new-origin) + (sub-vect (m corner2) new-origin))))))) + +(define (flip-vert painter) + (transform-painter painter + (make-vect 0.0 1.0) + (make-vect 1.0 1.0) + (make-vect 0.0 0.0))) + +(define (flip-horiz painter) + (transform-painter painter + (make-vect 1.0 0.0) + (make-vect 0.0 0.0) + (make-vect 1.0 1.0))) |