summaryrefslogblamecommitdiffstats
path: root/ex/2/51.rkt
blob: 347bca30834bc71e56650423b6b673242746c834 (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                     

                      



                  



































                                          








                                                       
;;;; License: CC0-1.0

#lang racket

(provide beside below)

(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)))))


;;; below in terms of rotate operations
(define (below-rot painter1 painter2)
  (let ((painter1-270 (counterclockwise-270 painter1))
        (painter2-270 (counterclockwise-270 painter2)))
    (counterclockwise-270
     (counterclockwise-180
      (beside painter1-270 painter2-270)))))