-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample1.rkt
64 lines (52 loc) · 2.04 KB
/
example1.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#lang racket
(require "tessellation.rkt")
(define g
(generate-grid
(circle 1)
(curve (pt -1 1) .. (pt 1 -1))
(curve (pt -1 -1) .. (pt 1 1))
(curve (pt -1 -1) .. (pt -1 1))
(curve (pt -1 1) .. (pt 1 1))
(curve (pt 1 1) .. (pt 1 -1))
(curve (pt -1 -1) .. (pt 1 -1))
(rotate90 (hmirror (vmirror (curve (med -1 a l) .. l))))
(curve (pt 0 -1) .. (pt 0 1))
(curve (pt -1 0) .. (pt 1 0))))
(display-grid g)
(with-window (window -1 5 -1 5)
(let ((apricot (make-color* #xFF #xCC #xB2))
(yellow (make-color* #xFF #xF4 #x82))
(cornsilk (make-color* #xFF #xF6 #xDC))
(deep-taupe (make-color* #x7A #x62 #x63))
(brown (make-color* #xE4 #xB7 #x47))
(inner-star (with-grid g (curve ak -- ag -- p -- ac -- ab -- af -- q -- aa -- ad -- ah -- o -- ae -- aj -- ai -- r -- al -- cycle))))
(draw
;; The stars around the center.
(color apricot
(tessellate g 3 3
(fill inner-star)))
;; The center star.
(color yellow
(tessellate g (1 1) (1 1)
(fill inner-star)))
;; The background.
(color cornsilk
(tessellate g 3 3
(fill (rotate90 (hmirror (vmirror (curve v -- a -- ac -- i -- cycle)))))))
;; The lower, dark wire frame.
(color deep-taupe
(penwidth 20
(tessellate g 3 3
(curve p -- i -- q -- l -- o -- n -- r -- f -- p)
(rotate/4 (curve v -- ak -- z)))))
;; Divede the lower frame into two.
(color "white"
(penwidth 3
(tessellate g 3 3
(curve p -- i -- q -- l -- o -- n -- r -- f -- p)
(rotate/4 (curve v -- ak -- z)))))
;; The golden frame on top.
(penwidth 6 (color brown
(tessellate g 3 3
inner-star
(vmirror (hmirror (curve g -- p)))))))))