Debian Codegraph @

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

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