1 |
|
defaultfont := "phvr8r"; |
2 |
|
|
3 |
|
boolean colors; |
4 |
|
colors = false; |
5 |
|
|
6 |
verbatimtex |
verbatimtex |
7 |
\documentclass{article} |
\documentclass{article} |
8 |
\usepackage{multicol} |
\usepackage{multicol} |
24 |
\font\foofontii = cmcss12 scaled 1000 |
\font\foofontii = cmcss12 scaled 1000 |
25 |
etex; |
etex; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
def doc(suffix s)(expr col, pict) = |
def doc(suffix s)(expr col, pict) = |
30 |
picture s.p; |
picture s.p; |
31 |
s.p = nullpicture; |
s.p = nullpicture; |
32 |
addto s.p contour bbox(pict) withcolor col; |
addto s.p contour bbox(pict) |
33 |
|
if colors: |
34 |
|
withcolor col |
35 |
|
else: |
36 |
|
withcolor (.95, .95, .95) |
37 |
|
fi |
38 |
|
; |
39 |
addto s.p also pict; |
addto s.p also pict; |
40 |
addto s.p doublepath bbox(s.p); |
addto s.p doublepath bbox(s.p) withpen pencircle scaled 4pt; |
41 |
pair s.size; |
pair s.size; |
42 |
s.size = (urcorner pict) - (llcorner pict); |
s.size = (urcorner pict) - (llcorner pict); |
43 |
pair s.loc; |
pair s.loc; |
55 |
enddef; |
enddef; |
56 |
|
|
57 |
vardef docpicclip(suffix s)(expr locp, clipp) = |
vardef docpicclip(suffix s)(expr locp, clipp) = |
58 |
save p; |
save p, pa; |
59 |
picture p; |
picture p; |
60 |
p := docpicraw(s, locp); |
p := docpicraw(s, locp); |
61 |
|
path pa; |
62 |
|
addto p doublepath clipp transformed locp withpen pencircle scaled 4pt; |
63 |
clip p to clipp transformed locp; |
clip p to clipp transformed locp; |
64 |
addto p doublepath (clipp transformed locp) withpen pencircle scaled 4pt; |
clip p to bbox(s.p) transformed locp; |
65 |
addto currentpicture also p; |
addto currentpicture also p; |
66 |
enddef; |
enddef; |
67 |
|
|
109 |
locatelinkend(b, ind); |
locatelinkend(b, ind); |
110 |
plainlinkend(a, ind) |
plainlinkend(a, ind) |
111 |
plainlinkend(b, ind) |
plainlinkend(b, ind) |
112 |
draw ((0,0) transformed lnk[ind].a.loc){right} .. tension 2 .. |
draw ((0,0) transformed lnk[ind].a.loc){right} .. tension 1.5 .. |
113 |
((0,0) transformed lnk[ind].b.loc){right} withpen pencircle scaled 6pt; |
((0,0) transformed lnk[ind].b.loc){right} withpen pencircle scaled 6pt; |
114 |
enddef; |
enddef; |
115 |
|
|
117 |
(x-2*r,y)...(x,y-r)...(x+2*r,y)...(x,y+r)...cycle |
(x-2*r,y)...(x,y-r)...(x+2*r,y)...(x,y+r)...cycle |
118 |
enddef; |
enddef; |
119 |
|
|
120 |
link("a", cir(50,30,25), "c", cir(75,110,40)); |
link("a", cir(50,30,25), "c", cir(70,160,37)); |
121 |
link("b", cir(50,230,30), "a", cir(350,290,30)); |
link("b", cir(50,230,30), "a", cir(350,290,30)); |
122 |
link("b", cir(60,170,35), "d", cir(150,60,50)); |
link("b", cir(60,170,35), "d", cir(150,60,50)); |
123 |
link("c", cir(70,160,37), "b", cir(58,310,32)); |
link("c", cir(75,110,40), "b", cir(58,310,32)); |
124 |
|
link("a", cir(48,100,26), "e", cir(220,150,32)); |
125 |
|
|
126 |
|
|
127 |
|
|
159 |
docpic(d, identity shifted (b.loc + (0, -400))); |
docpic(d, identity shifted (b.loc + (0, -400))); |
160 |
docpic(e, identity shifted (d.loc + (xpart(d.size)+50, 0))); |
docpic(e, identity shifted (d.loc + (xpart(d.size)+50, 0))); |
161 |
|
|
162 |
|
def doclabel(suffix d)(expr l) = |
163 |
|
label.lrt(l infont defaultfont scaled 10 , d.loc + (0,ypart d.size)); |
164 |
|
enddef; |
165 |
|
|
166 |
|
doclabel(a, "1"); |
167 |
|
doclabel(b, "2"); |
168 |
|
doclabel(c, "3"); |
169 |
|
doclabel(d, "4"); |
170 |
|
doclabel(e, "5"); |
171 |
|
|
172 |
plainlink(0); |
plainlink(0); |
173 |
plainlink(1); |
plainlink(1); |
174 |
plainlink(2); |
plainlink(2); |
175 |
plainlink(3); |
plainlink(3); |
176 |
|
plainlink(4); |
177 |
|
|
178 |
% addto currentpicture also a.p; |
% addto currentpicture also a.p; |
179 |
% |
% |
203 |
withpen pencircle scaled 2pt;; |
withpen pencircle scaled 2pt;; |
204 |
enddef; |
enddef; |
205 |
|
|
|
beginfig(2); |
|
206 |
|
|
207 |
docpic(a, identity shifted (-50, -50) scaled 1.2); |
bboxmargin := 0pt; |
208 |
|
|
209 |
|
def atrans(expr e) = |
210 |
|
identity shifted(-50,-50) scaled (e[1.2, .7]) rotated (e*15) shifted (e[(0,0), (-150,25)]) |
211 |
|
enddef; |
212 |
|
|
213 |
|
def aclip(expr e) = |
214 |
|
lnk0a.p scaled ((sqrt(e))[7, 2]) shifted lnk0a.l |
215 |
|
enddef; |
216 |
|
|
217 |
|
def ctrans(expr e) = |
218 |
|
identity shifted (-lnk0b.l) scaled (e[.7,1.2]) rotated (e[-15,0]) shifted (e[(150,-60),(0,0)]) |
219 |
|
enddef; |
220 |
|
|
221 |
|
def cclip(expr e) = |
222 |
|
lnk0b.p scaled (e[1.05, 5]) shifted lnk0b.l |
223 |
|
enddef; |
224 |
|
|
225 |
|
|
226 |
|
def btrans(expr e) = |
227 |
|
identity shifted (-lnk3b.l) scaled (e[.7,1.15]) rotated (e[-15,0]) |
228 |
|
shifted (e[(150, -70),(0,20)]) |
229 |
|
enddef; |
230 |
|
def bclip(expr e) = |
231 |
|
lnk3b.p scaled(e[1.05, 5]) shifted lnk3b.l |
232 |
|
enddef; |
233 |
|
|
234 |
|
def linkline(expr ind) = |
235 |
|
locatelinkend(a, ind); |
236 |
|
locatelinkend(b, ind); |
237 |
|
draw ((0,0) transformed lnk[ind].a.loc) .. |
238 |
|
((0,0) transformed lnk[ind].b.loc) withpen pencircle scaled 3pt; |
239 |
|
enddef; |
240 |
|
|
241 |
|
def aniframe(expr fract) = |
242 |
|
docpicclip(a, atrans(fract), aclip(fract)); |
243 |
|
% link 0 |
244 |
|
docpicclip(c, ctrans(fract), cclip(fract)); |
245 |
|
if fract>.5: |
246 |
|
docpicclip(a, atrans(fract), aclip(fract)); |
247 |
|
fi; |
248 |
|
|
249 |
|
if fract < .01: |
250 |
|
docpicclip(e, |
251 |
|
identity shifted (-lnk4b.l) scaled .7 rotated -5 shifted (150,60), |
252 |
|
lnk4b.p scaled 1.5 shifted lnk4b.l); |
253 |
|
linkline(4); |
254 |
|
fi; |
255 |
|
if fract > .99: |
256 |
|
docpicclip(b, btrans(0), bclip(0)); |
257 |
|
linkline(3); |
258 |
|
fi; |
259 |
|
|
260 |
docpicclip(c, identity shifted (-lnk0b.l) scaled .7 rotated -15 shifted(150,-60), |
linkline(0); |
261 |
lnk0b.p scaled 1.05 shifted lnk0b.l); |
cscreen; |
262 |
|
|
263 |
locatelinkend(a, 0); |
enddef; |
|
locatelinkend(b, 0); |
|
264 |
|
|
|
draw ((0,0) transformed lnk0.a.loc) .. |
|
|
((0,0) transformed lnk0.b.loc) withpen pencircle scaled 3pt; |
|
265 |
|
|
266 |
cscreen; |
% Initial position |
267 |
|
|
268 |
|
beginfig(2); |
269 |
|
aniframe(0); |
270 |
endfig; |
endfig; |
271 |
|
|
272 |
beginfig(3); |
beginfig(3); |
273 |
|
aniframe(0.3); |
274 |
|
endfig; |
275 |
|
|
276 |
|
beginfig(4); |
277 |
|
aniframe(0.65); |
278 |
|
endfig; |
279 |
|
|
280 |
|
beginfig(5); |
281 |
|
aniframe(1.0); |
282 |
|
endfig; |
283 |
|
|
284 |
docpic(b, identity shifted (-.5*b.size) scaled 1.4); |
% Now, c starts to move away. |
285 |
|
% Inverting the parameter to make change easier. |
286 |
|
|
287 |
docpicclip(a, identity shifted (-lnk1b.l) scaled .7 rotated -15 shifted (150,10), |
def ctrans(expr e) = |
288 |
|
identity shifted (e[(-lnk3a.l),(-lnk0b.l)]) scaled (e[.7,1.2]) rotated (e[15,0]) shifted (e[(-150,-30),(0,0)]) |
289 |
|
enddef; |
290 |
|
|
291 |
|
def cclip(expr e) = |
292 |
|
lnk3a.p scaled (e[1.05, 5]) shifted lnk3a.l |
293 |
|
enddef; |
294 |
|
|
295 |
|
|
296 |
|
def aniframe(expr fract) = |
297 |
|
|
298 |
|
% link 0 |
299 |
|
docpicclip(c, ctrans(1-fract), cclip(1-fract)); |
300 |
|
docpicclip(b, btrans(fract), bclip(fract)); |
301 |
|
if fract>.5: |
302 |
|
fi; |
303 |
|
|
304 |
|
if fract < .01: |
305 |
|
docpicclip(a, atrans(fract), aclip(fract)); |
306 |
|
linkline(0); |
307 |
|
fi; |
308 |
|
|
309 |
|
if fract > .99: |
310 |
|
docpicclip(d, |
311 |
|
identity shifted (-lnk2b.l) scaled .7 rotated -15 shifted (150,-140), |
312 |
|
lnk2b.p scaled 1.05 shifted lnk2b.l); |
313 |
|
linkline(2); |
314 |
|
|
315 |
|
docpicclip(a, |
316 |
|
identity shifted (-lnk1b.l) scaled .7 rotated -15 shifted (150,-50), |
317 |
lnk1b.p scaled 1.5 shifted lnk1b.l); |
lnk1b.p scaled 1.5 shifted lnk1b.l); |
318 |
|
linkline(1); |
319 |
|
|
320 |
locatelinkend(a, 1); |
fi; |
|
locatelinkend(b, 1); |
|
321 |
|
|
322 |
draw ((0,0) transformed lnk1.a.loc) .. |
linkline(3); |
323 |
((0,0) transformed lnk1.b.loc) withpen pencircle scaled 3pt; |
cscreen; |
324 |
|
enddef; |
325 |
|
|
326 |
cscreen; |
beginfig(6); |
327 |
|
aniframe(.3); |
328 |
|
endfig; |
329 |
|
beginfig(7); |
330 |
|
aniframe(.65); |
331 |
|
endfig; |
332 |
|
beginfig(8); |
333 |
|
aniframe(1); |
334 |
endfig; |
endfig; |
335 |
|
|
336 |
|
|
337 |
|
|
338 |
verbatimtex |
verbatimtex |
339 |
\end{document} |
\end{document} |
340 |
etex |
etex |