1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17u : = 3 ;
18h : = 5 u ;
19wt : = 5 u ;
20wb : = .25 wt ;
21o : = .1 u ;
22pw : = .5 u ;
23
24drawoptions ( withpen pencircle scaled pw ) ;
25
26path lefttriangle , righttriangle , sublefttriangle , subrighttriangle ;
27
28pair s ; s = ( 2 wb , 0 ) ;
29
30x 1 t = x 2 t = 0 ;
31x 3 t = wt ;
32y 3 t = .5 h ;
33z 1 t z 2 t = ( z 3 t z 2 t ) rotated 60 ;
34
35z 4 t = ( z 2 t z 3 t ) intersectionpoint ( ( z 1 t z 2 t ) shifted s ) ;
36z 5 t = ( z 3 t z 1 t ) intersectionpoint ( ( z 1 t z 2 t ) shifted s ) ;
37
38righttriangle = z 1 t z 2 t z 3 t cycle ;
39lefttriangle = righttriangle rotatedaround ( ( 0 , .5 h ) , 180 ) shifted ( wt , 0 ) ;
40
41subrighttriangle = z 4 t -- ( ( z 2 t z 3 t z 1 t ) shifted s ) z 5 t ;
42sublefttriangle = subrighttriangle rotatedaround ( ( 0 , .5 h ) , 180 ) shifted ( wt , 0 ) ;
43
44path sidebar ;
45
46x 1 b = x 4 b = 0 ;
47x 2 b = x 3 b = wb ;
48y 1 b = y 2 b = y 1 t ;
49y 3 b = y 4 b = y 2 t ;
50
51sidebar = z 1 b z 2 b z 3 b z 4 b cycle ;
52
53path midbar , onebar , twobar ;
54
55hh = abs ( y 1 t y 2 t ) ;
56
57
58midbar : = unitsquare scaled hh ;
59onebar : = unitsquare xscaled ( hh 3 ) yscaled hh ;
60twobar : = onebar ;
61
62def prepareglyph =
63 drawoptions ( withpen pencircle scaled .5 u ) ;
64enddef ;
65
66def finishglyph =
67 set_outer_boundingbox currentpicture ;
68 bboxmargin : = o ;
69 setbounds currentpicture to bbox currentpicture ;
70
71enddef ;
72
73beginfig ( 1 ) ;
74 prepareglyph ;
75 fill lefttriangle ;
76 draw lefttriangle ;
77 finishglyph ;
78endfig ;
79
80beginfig ( 2 ) ;
81 prepareglyph ;
82 fill righttriangle ;
83 draw righttriangle ;
84 finishglyph ;
85endfig ;
86
87beginfig ( 3 ) ;
88 prepareglyph ;
89 fill sidebar ;
90 draw sidebar ;
91 fill lefttriangle shifted ( .5 s ) ;
92 draw lefttriangle shifted ( .5 s ) ;
93 finishglyph ;
94endfig ;
95
96beginfig ( 4 ) ;
97 prepareglyph ;
98 fill righttriangle ;
99 draw righttriangle ;
100 fill sidebar shifted ( wt , 0 ) ;
101 draw sidebar shifted ( wt , 0 ) ;
102 finishglyph ;
103endfig ;
104
105beginfig ( 5 ) ;
106 prepareglyph ;
107 fill lefttriangle ;
108 draw lefttriangle ;
109 fill lefttriangle shifted s ;
110 draw lefttriangle shifted s ;
111 finishglyph ;
112endfig ;
113
114beginfig ( 6 ) ;
115 prepareglyph ;
116 fill righttriangle ;
117 draw righttriangle ;
118 fill righttriangle shifted s ;
119 draw righttriangle shifted s ;
120 finishglyph ;
121endfig ;
122
123beginfig ( 7 ) ;
124 prepareglyph ;
125 fill midbar ;
126 draw midbar ;
127 finishglyph ;
128endfig ;
129
130beginfig ( 8 ) ;
131 prepareglyph ;
132 fill onebar ;
133 draw onebar ;
134 finishglyph ;
135endfig ;
136
137beginfig ( 9 ) ;
138 prepareglyph ;
139 fill twobar ;
140 draw twobar ;
141 fill twobar shifted ( pw hh 2 , 0 ) ;
142 draw twobar shifted ( pw hh 2 , 0 ) ;
143 finishglyph ;
144endfig ;
145
146beginfig ( 101 ) ;
147 prepareglyph ;
148 draw lefttriangle ;
149 finishglyph ;
150endfig ;
151
152beginfig ( 102 ) ;
153 prepareglyph ;
154 draw righttriangle ;
155 finishglyph ;
156endfig ;
157
158beginfig ( 103 ) ;
159 prepareglyph ;
160 draw sidebar ;
161 draw lefttriangle shifted ( .5 s ) ;
162 finishglyph ;
163endfig ;
164
165beginfig ( 104 ) ;
166 prepareglyph ;
167 draw righttriangle ;
168 draw sidebar shifted ( wt , 0 ) ;
169 finishglyph ;
170endfig ;
171
172beginfig ( 105 ) ;
173 prepareglyph ;
174 draw lefttriangle ;
175 draw lefttriangle shifted s ;
176 finishglyph ;
177endfig ;
178
179beginfig ( 106 ) ;
180 prepareglyph ;
181 draw righttriangle ;
182 draw righttriangle shifted s ;
183 finishglyph ;
184endfig ;
185
186beginfig ( 107 ) ;
187 prepareglyph ;
188 draw midbar ;
189 finishglyph ;
190endfig ;
191
192beginfig ( 108 ) ;
193 prepareglyph ;
194 draw onebar ;
195 finishglyph ;
196endfig ;
197
198beginfig ( 109 ) ;
199 prepareglyph ;
200 draw twobar ;
201 draw twobar shifted ( pw hh 2 , 0 ) ;
202 finishglyph ;
203endfig ;
204
205beginfig ( 201 ) ;
206 prepareglyph ;
207 draw lefttriangle ;
208 finishglyph ;
209endfig ;
210
211beginfig ( 202 ) ;
212 prepareglyph ;
213 draw righttriangle ;
214 finishglyph ;
215endfig ;
216
217beginfig ( 203 ) ;
218 prepareglyph ;
219 draw sidebar ;
220 draw lefttriangle shifted ( .5 s ) ;
221 finishglyph ;
222endfig ;
223
224beginfig ( 204 ) ;
225 prepareglyph ;
226 draw righttriangle ;
227 draw sidebar shifted ( wt , 0 ) ;
228 finishglyph ;
229endfig ;
230
231beginfig ( 205 ) ;
232 prepareglyph ;
233 draw sublefttriangle shifted s ;
234 draw lefttriangle shifted s ;
235 finishglyph ;
236endfig ;
237
238beginfig ( 206 ) ;
239 prepareglyph ;
240 draw subrighttriangle ;
241 draw righttriangle ;
242 finishglyph ;
243endfig ;
244
245beginfig ( 207 ) ;
246 prepareglyph ;
247 draw midbar ;
248 finishglyph ;
249endfig ;
250
251beginfig ( 208 ) ;
252 prepareglyph ;
253 draw onebar ;
254 finishglyph ;
255endfig ;
256
257beginfig ( 209 ) ;
258 prepareglyph ;
259 draw twobar ;
260 draw twobar shifted ( pw hh 2 , 0 ) ;
261 finishglyph ;
262endfig ;
263
264
265beginfig ( 999 ) ;
266
267picture collection [ ] ;
268
269prepareglyph ;
270draw lefttriangle ;
271finishglyph ;
272collection [ 201 ] : = currentpicture ;
273currentpicture : = nullpicture ;
274
275prepareglyph ;
276draw righttriangle ;
277finishglyph ;
278collection [ 202 ] : = currentpicture ;
279currentpicture : = nullpicture ;
280
281prepareglyph ;
282draw sidebar ;
283draw lefttriangle shifted ( .5 s ) ;
284finishglyph ;
285collection [ 203 ] : = currentpicture ;
286currentpicture : = nullpicture ;
287
288prepareglyph ;
289draw righttriangle ;
290draw sidebar shifted ( wt , 0 ) ;
291finishglyph ;
292collection [ 204 ] : = currentpicture ;
293currentpicture : = nullpicture ;
294
295prepareglyph ;
296draw sublefttriangle shifted s ;
297draw lefttriangle shifted s ;
298finishglyph ;
299collection [ 205 ] : = currentpicture ;
300currentpicture : = nullpicture ;
301
302prepareglyph ;
303draw subrighttriangle ;
304draw righttriangle ;
305finishglyph ;
306collection [ 206 ] : = currentpicture ;
307currentpicture : = nullpicture ;
308
309prepareglyph ;
310draw midbar ;
311finishglyph ;
312collection [ 207 ] : = currentpicture ;
313currentpicture : = nullpicture ;
314
315prepareglyph ;
316draw onebar ;
317finishglyph ;
318collection [ 208 ] : = currentpicture ;
319currentpicture : = nullpicture ;
320
321prepareglyph ;
322draw twobar ;
323draw twobar shifted ( pw hh 2 , 0 ) ;
324finishglyph ;
325collection [ 209 ] : = currentpicture ;
326currentpicture : = nullpicture ;
327
328for i = 201 upto 209 :
329 collection [ i ] : = collection [ i ] shifted center collection [ i ] ;
330endfor ;
331
332addto currentpicture also collection [ 205 ] shifted ( 0 , 0 )
333 withcolor ( .3 , .4 , .5 ) ;
334addto currentpicture also collection [ 202 ] shifted ( 0 , 1.5 h )
335 withcolor ( .5 , .6 , .7 ) ;
336addto currentpicture also collection [ 201 ] shifted ( 1.5 h , 0 )
337 withcolor ( .6 , .7 , .8 ) ;
338addto currentpicture also collection [ 206 ] shifted ( 1.5 h , 1.5 h )
339 withcolor ( .4 , .5 , .6 ) ;
340
341collection [ 210 ] : = currentpicture ;
342currentpicture : = nullpicture ;
343
344bboxmargin : = .25 u ;
345
346fill bbox collection [ 210 ] withcolor .95 ( 1 , 1 , 0 ) ;
347addto currentpicture also collection [ 210 ] ;
348
349endfig ;
350
351end
352 |