1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17if known metafun_loaded_misc : endinput ; fi ;
18
19newinternal boolean metafun_loaded_misc ; metafun_loaded_misc := true ; immutable metafun_loaded_misc ;
20
21
22
23
24def showenvelope(expr pth, psh) =
25 image (
26 save e, usedpath, convpath, usedpen ;
27 path e, usedpath, convpath, somepath ; pen usedpen ;
28
29interim linejoin := 1;
30
31 usedpath := psh rotated eps ;
32 usedpen := makepen(usedpath) ;
33 convpath := convexed usedpath ;
34
35 if cycle pth :
36 enfill
37 pth
38 withpen usedpen
39 withcolor red
40 fi ;
41
42 if cycle pth : fill else : draw fi
43 pth
44 withcolor blue
45 withpen usedpen
46 withtransparency (1,.5)
47 ;
48 drawarrow pth ;
49 drawpoints pth ;
50
51 for i within pth :
52 drawarrow convpath shifted pathpoint withcolor yellow dashed evenly ;
53 drawarrow usedpath shifted pathpoint withcolor white;
54 drawpoints usedpath shifted pathpoint withcolor white ;
55 endfor ;
56
57 interim defaultscale := .4 ;
58
59 e := envelope usedpen of pth ;
60 draw e withcolor green withpen pencircle scaled 1 ;
61 drawpoints e ;
62 drawpointlabels e withcolor green ;
63
64 e := envelope usedpen of reverse pth ;
65 draw e withcolor yellow withpen pencircle scaled 1 ;
66 drawpoints e ;
67 drawpointlabels e withcolor yellow ;
68
69 )
70enddef ;
71
72vardef showreducedenvelope(expr pth, psh, pthtxt, pshtxt) =
73 image (
74 save e, r ; path e, r ;
75 e := envelope psh of pth ;
76 r := reducedenvelope(e) ;
77 draw pth withpen pencircle scaled 2 withcolor "darkgray";
78 draw e withpen pencircle scaled 2 withcolor "darkred" ;
79 drawpoints e withcolor "darkred" ;
80 drawpointlabels e withcolor "darkred" ;
81 draw r withpen pencircle scaled 1 withcolor "darkgreen" ;
82 drawpoints r withpen pencircle scaled 5 withcolor "darkblue" ;
83 drawpointlabels r withcolor "darkblue" ;
84 draw r dashed evenly withcolor "white" ;
85 draw
86 textext.bot ("\strut\tttf path " & pthtxt & " pen " & pshtxt)
87 shifted (center bottomboundary currentpicture)
88 shifted (0,LineHeight) ;
89 ;
90 )
91enddef ;
92
93
94 |