Debian Codegraph @

texmf-dist/doc/metapost/featpost/example/downloadicon.mp

raw
1 % downloadicon.mp
2 % L. Nobre G.
3 % 2004
4
5 input featpost3Dplus2D;
6
7 f := 0.4[(12,3,2),(2,5,6)]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Max: 0.8
8 Spread := 30;
9 TDAtiplen := 0.65;
10 TDAhalftipbase := 0.35;
11 TDAhalfthick := 0.15;
12
13 beginfig(1);
14 color tracecol, lockcol, arrowcol;
15 numeric altura, compri, radius, altfrac, comfrac, radang;
16 path theside, thefront, thelocka, thelockb, thelock;
17 color poi[], startarrow, endarrow;
18 numeric numpl, aux, i;
19 altura = 1;
20 compri = 2;
21 radius = 0.8;
22 altfrac = 0.2;
23 comfrac = 0.15;
24 radang = 37;
25 numpl = 9;
26 tracecol = blue;
27 lockcol = black;
28 arrowcol = (0.7,0.2,0.1);
29 startarrow = (0,-radius,2);
30 endarrow = (0,0,radius);
31 currentpen := pencircle scaled 2.4mm;
32 drawoptions( withcolor tracecol );
33 rigorousdisc( 0, true, (-0.5compri,0,0), radius, (compri,0,0) );
34 poi1 = (0.5compri,-radius,0);
35 poi2 = (0.5compri,radius,0);
36 poi3 = (-0.5compri,radius,0);
37 poi4 = (0.5compri,-radius,-altura);
38 poi5 = (0.5compri,radius,-altura);
39 poi6 = (-0.5compri,radius,-altura);
40 theside = rp(poi1)--rp(poi2)--rp(poi5)--rp(poi4)--cycle;
41 thefront= rp(poi2)--rp(poi3)--rp(poi6)--rp(poi5)--cycle;
42 drawoptions( withcolor white );
43 fill theside;
44 fill thefront;
45 thelocka = rp((comfrac*compri,radius,-altfrac*altura))
46 --rp((comfrac*compri,radius,0));
47 thelockb = rp((-comfrac*compri,radius,-altfrac*altura))
48 --rp((-comfrac*compri,radius,0));
49 for i=1 upto numpl:
50 aux := i*radang/numpl;
51 poi7 := (comfrac*compri,radius*cosd(aux),radius*sind(aux));
52 poi8 := (-comfrac*compri,radius*cosd(aux),radius*sind(aux));
53 thelocka := thelocka...rp(poi7);
54 thelockb := thelockb...rp(poi8);
55 endfor;
56 thelock = thelocka--reverse thelockb--cycle;
57 drawoptions( withcolor lockcol );
58 filldraw thelock;
59 drawoptions( withcolor tracecol );
60 draw theside;
61 draw thefront;
62 drawoptions( withcolor arrowcol );
63 tdarrow( startarrow, endarrow );
64 endfig;
65
66 end;