1
2
3beginfig (1) ;
4
5 path p, q ;
6
7 p := (0,110)..(50,110) shifted (0,-15)..(100,110)--
8 (50,50) shifted (10,0) ..(50,50) shifted (0,2.5)..
9 (50,50) shifted(-10,0)cycle ;
10 q := (5,0)--(95,0)--(95,30)..(50,0) shifted (0,10)..(5,30)cycle ;
11
12 pickup pencircle scaled 15 ;
13 drawdot (80,100) withcolor .6red ;
14 drawdot (65,95) withcolor .6red ;
15 drawdot (50,95) withcolor .6red ;
16 drawdot (35,95) withcolor .6red ;
17
18 drawdot (50,60) withcolor .6red ;
19 drawdot (50,35) withcolor .6red ;
20 drawdot (50,10) withcolor .6red ;
21 drawdot (70,10) withcolor .6red ;
22 drawdot (32.5,10) withcolor .6red ;
23
24 pickup pencircle scaled 5 ;
25 fill p withcolor .6green ; draw p withcolor .4green ;
26 fill q withcolor .6green ; draw q withcolor .4green ;
27
28 bboxmargin := 2.5 ; p := bbox currentpicture ;
29 picture s ; s := currentpicture ; currentpicture := nullpicture ;
30
31 pickup pencircle scaled 2.5 ;
32 fill p withcolor .4blue ;
33 addto currentpicture also s ;
34
35endfig ;
36
37
38
39beginfig (2) ;
40
41 boolean angles [], lengths[], colors [][][] ;
42 numeric a, l, r, g, b, n ;
43 path p ;
44 color c ;
45
46 draw fullsquare scaled 150 withpen pencircle scaled 1 withcolor .5white ;
47
48 n := 0 ;
49 forever :
50 a := 6 round(uniformdeviate 60) ;
51 l := 40 round(uniformdeviate 60) ;
52 r := 2 round(uniformdeviate 6) ;
53 g := 2 round(uniformdeviate 6) ;
54 b := 2 round(uniformdeviate 6) ;
55 if (a>0) and not known angles [a] and not known lengths[l] and not known colors [r][g][b] :
56 n := n 1 ;
57 angles [a] := true ;
58 lengths[l] := true ;
59 colors [r][g][b] := true ;
60 p := (originorigin shifted (0,.5l)) rotatedaround(origin,a) ;
61 draw p withpen pencircle scaled 2 withcolor (r10,g10,b10) ;
62 drawdot point 1 of p withpen pencircle scaled 4 withcolor (r10,g10,b10) ;
63 p := (origin shifted (0,.5l+8)origin shifted(0,100)) rotatedaround(origin,a) ;
64 draw p withpen pencircle scaled 2 withcolor (r10,g10,b10) ;
65 drawdot point 0 of p withpen pencircle scaled 4 withcolor (r10,g10,b10) ;
66 fi ;
67 exitif n >= 60 ;
68 endfor ;
69
70 drawdot
71 origin
72 withpen pencircle scaled 10
73 withcolor white ;
74
75 fill
76 ((fullcircle scaled 130) peepholed (fullsquare scaled 150))
77 withcolor (1,1,1)(1,.62,.06);
78
79 clip currentpicture to fullsquare scaled 130 ;
80
81endfig ;
82
83
84
85beginfig(3)
86
87 path a, b, p, q ;
88 pair s, t, u, v ;
89 color c ;
90 numeric h, w, r ;
91
92 pickup pencircle scaled 10 ;
93
94 h := 120 ;
95 w := 80 ;
96 r := 30 ;
97
98 a := (0,0)..(0,.5h) shifted (r,0)..(0,h) ;
99 b := (w,0)..(w,.5h) shifted ( r,0)..(w,h) ;
100
101 draw a withcolor .4white;
102 draw b withcolor .4white;
103
104 def moved (expr i) =
105 ((i) 10 uniformdeviate 20)
106 enddef ;
107
108 for i=5 step 10 until h-5 :
109 s := (point (length(a)(ih)) of a) ;
110 t := (point (length(b)(1ih)) of b) ;
111 u := (st) intersectionpoint ((.25w,0)--(.25w,h)) ;
112 v := (st) intersectionpoint ((.75w,0)--(.75w,h)) ;
113 p := s..(xpart u,moved(ypart u))..(xpart v,moved(ypart v))..t ;
114 c := (0,.4uniformdeviate.55,0) ;
115 l := length(p) ;
116 l := .25luniformdeviate.5l ;
117 q := p cutafter point l of p ;
118 pickup pencircle scaled 2.5 ;
119 draw p withcolor c ;
120 pickup pencircle scaled 5 ;
121 drawdot point 0 of p withcolor c ;
122 drawdot point infinity of p withcolor c ;
123 endfor ;
124
125 picture s ; s := currentpicture ; currentpicture := nullpicture ;
126
127 bboxmargin := 2.5 ; fill bbox s withcolor .85white ;
128
129 addto currentpicture also s ;
130
131endfig;
132
133
134
135def dpuppet (expr v, w) =
136 v .5w uniformdeviate w
137enddef ;
138
139def somepuppet (expr s, r) =
140 picture p ; p := currentpicture ; currentpicture := nullpicture ;
141 draw ((-10,0)--(10,0)) ;
142 for i:=-10 step 5 until 10 :
143 draw ((i,0)--(dpuppet(i,2),-10)) ;
144 endfor ;
145 currentpicture := currentpicture rotated r shifted s ;
146 addto currentpicture also p ;
147enddef ;
148
149def puppet (expr loc, sca, col) =
150 picture s ; s := currentpicture ; currentpicture := nullpicture ;
151
152 pair a ; a := (dpuppet( 20,5),dpuppet( 0, 5)) ;
153 pair b ; b := (dpuppet(-20,5),dpuppet( 0, 5)) ;
154 pair c ; c := (dpuppet( 30,5),dpuppet(60,10)) ;
155 pair d ; d := (dpuppet(-30,5),dpuppet(60,10)) ;
156 pair e ; e := (dpuppet( 0,5),dpuppet(30,10)) ;
157 pair f ; f := (dpuppet( 0,5),dpuppet(50,10)) ;
158 pair g ; g := (dpuppet( 0,5),dpuppet(65,10)) ;
159
160 pair f ; f := (.6uniformdeviate.1)[e,g] ;
161
162 drawoptions (withcolor col) ;
163
164 somepuppet(a,dpuppet( 20,5)) ;
165 somepuppet(b,dpuppet( -20,5)) ;
166 somepuppet(c,dpuppet( 120,5)) ;
167 somepuppet(d,dpuppet(-120,5)) ;
168
169 draw a -- e ;
170 draw b -- e ;
171 draw c -- f ;
172 draw d -- f ;
173 draw e -- g ;
174 draw fullcircle scaled 25 shifted (g shifted (0,12.5));
175
176 drawoptions () ;
177
178 currentpicture := currentpicture scaled sca shifted loc ;
179 addto currentpicture also s ;
180enddef ;
181
182beginfig (4) ;
183
184 pickup pencircle scaled 0 ;
185
186 color col ; col := (.4,.8,.6) ;
187
188 puppet((-20, 0) ,.20, 0.700col) ;
189 puppet(( 10,10) ,.30, 0.750col) ;
190 puppet(( 30,20) ,.40, 0.800col) ;
191 puppet((-20,30) ,.35, 0.850col) ;
192 puppet(( 20,60) ,.20, 0.900col) ;
193 puppet(( -5,65) ,.25, 0.950col) ;
194
195 picture s ; s := currentpicture ; currentpicture := nullpicture ;
196
197 bboxmargin := 15 ; fill bbox s withcolor .8(1,1,0) ;
198
199 addto currentpicture also s withpen pencircle scaled .8 ;
200
201 path b ; bboxmargin := -10 ; b := bbox currentpicture ;
202 numeric len ; len := length(b) ;
203 numeric stp ; stp := 20 ;
204 drawoptions(withpen pencircle scaled .8 withcolor .7red) ;
205 for i=len8stp step len4stp until lenlen8stp :
206 pair ii ; ii := point (dpuppet(i,len20stp)) of b ;
207 pair dd ; dd := (direction i of b) rotated (dpuppet(-90,10)) ;
208 draw ii shifted -.1dd withpen pencircle scaled 1.2 ;
209 draw ii--(ii shifted .25dd) ;
210 endfor ;
211
212endfig ;
213 |