; (define-struct posn (x y)) ; Included from draw.ss.
;
; A posn is:
; - (make-posn num num)
;
; Examples:
(define origin (make-posn 0 0))
(define p34 (make-posn 3 4))
; A color is one of {'red, 'yellow, 'white, 'black, 'blue, 'green}.
;
; Examples of color: (explicitly enumerated in data def'n).
;; translate: posn, num, num --> posn
;; Return the point which is a-point offset by (+x, +y).
;;
(define (translate a-point x y)
(make-posn (+ (posn-x a-point) x)
(+ (posn-y a-point) y)))
(translate p34 5 12) = (make-posn 8 16)
(translate origin 3 4) = p34
(translate p34 -3 -4) = origin
(define-struct circle (location radius color))
;
; A circle is:
; (make-circle posn num symbol color)
;
; Examples of circles:
;
(define circ1 (make-circle p34 1 'red)) ; A little red dot.
(define circ23 (make-circle origin 23 'blue))
(define-struct rectangle (location width height color))
;A rectangle is:
; (make-rectangle posn num num color)
;
;Examples:
(define rect1 (make-rectangle (make-posn 10 10) 15 30 'yellow))
(define rect2 (make-rectangle (make-posn 0 0) 2 2 'red))
;; A shape is a structure that contains
;; - a circle, or
; (;make-posn posn? posn-x posn-y
; translate-shape draw-shape draw-shapes circle-tool rectangle-tool
; circ1 rect1))
(define translate-shape 3)
(define draw-shape 4)
(define draw-shapes 5)
(define circle-tool 3)
(define rectangle-tool 6)
;(define circ1 7)
;(define rect1 8)