-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1-11-4.rkt~
37 lines (30 loc) · 967 Bytes
/
1-11-4.rkt~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname 1-11-4) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
; A Polygon is one of:
; – (list Posn Posn Posn)
; – (cons Posn Polygon)
; a plain background image
(define MT (empty-scene 50 50))
; Image Polygon -> Image
; renders the given polygon p into img
(define (render-poly img p)
img)
(check-expect
(render-poly MT triangle-p)
(scene+line
(scene+line
(scene+line MT 20 10 20 20 "red")
20 20 30 20 "red")
30 20 20 10 "red"))
(define triangle-p
(list
(make-posn 20 10)
(make-posn 20 20)
(make-posn 30 20)))
(define square-p
(list
(make-posn 10 10)
(make-posn 20 10)
(make-posn 20 20)
(make-posn 10 20)))