From 8ca00a84a20ac1db94a5ef2e677f44713f7df455 Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Sat, 4 Jun 2022 16:45:01 -0400 Subject: ex: 50.rkt: implement flip-horiz --- ex/2/49.rkt | 5 +++++ ex/2/50.rkt | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 ex/2/50.rkt (limited to 'ex') 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))) -- cgit v1.2.3