diff options
author | siddharth ravikumar <s@ricketyspace.net> | 2022-06-04 16:45:01 -0400 |
---|---|---|
committer | siddharth ravikumar <s@ricketyspace.net> | 2022-06-04 16:45:01 -0400 |
commit | 8ca00a84a20ac1db94a5ef2e677f44713f7df455 (patch) | |
tree | ed4c0d28657a8944c762720e932c716f9283bee3 /ex/2 | |
parent | bf6c8415e2e734527958a8399fbe6bc1033954c4 (diff) |
ex: 50.rkt: implement flip-horiz
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))) |