Debian Codegraph @

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

raw
1 % optest.mp
2 % L. Nobre G.
3 % 2000
4
5 beginfig(1);
6 % linecap := squared;
7 pickup pencircle scaled 0.1mm;
8 numeric salto, i, shif;
9 pair cen;
10 shif = 2cm;
11 cen = (10.5cm,14.845cm);
12 draw ((-shif,0)--(shif,0)) shifted cen;
13 draw ((0,-shif)--(0,shif)) shifted cen;
14 pickup pencircle scaled 0.05mm;
15 salto = 1mm;
16 for i = 20 upto 22:
17 draw fullcircle scaled (i*salto) shifted cen;
18 endfor;
19 for i = 27 upto 28:
20 draw unitsquare shifted (-0.5,-0.5)
21 scaled (i*salto)
22 rotated 45 shifted cen;
23 endfor;
24 for i = 29 upto 31:
25 draw fullcircle scaled (i*salto) shifted cen;
26 endfor;
27 for i = -10 step 2 until 10:
28 draw (origin--shif*(1-0.0125*abs(i))*dir(i)) shifted cen;
29 endfor;
30 endfig;
31
32 beginfig(2);
33 linecap := squared;
34 pickup pensquare scaled 0.15mm;
35 numeric salto, ix, iy;
36 path face;
37 picture descrit;
38 salto = 0.3in;
39 face = unitsquare xscaled 1.33 scaled 2;
40 fill face withcolor red;
41 draw face;
42 descrit = currentpicture;
43 currentpicture := nullpicture;
44 for iy = 1 upto 5:
45 for ix = 1 upto 5:
46 draw descrit shifted ( ix*salto, iy*salto );
47 endfor;
48 endfor;
49 endfig;
50
51 end;