Debian Codegraph @

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

raw
1 % avalzero.mp
2 % L. Nobre G.
3 % 1999
4
5 verbatimtex \documentclass{article} \usepackage{palatino} \usepackage{concmath} \usepackage{ccfonts} \begin{document} etex
6
7 beginfig(1); % crescente
8 numeric u;
9 u = 1in;
10 draw fullcircle scaled 2u;
11 draw (left--right) scaled u;
12 draw (down--up) scaled u;
13 draw (left--up) scaled u;
14 draw (left--down) scaled u;
15 path int, cresc, out;
16 int = halfcircle rotated -90 scaled (2*1.414u) shifted ((-0.999,0)*u);
17 out = halfcircle rotated -90 scaled 2u;
18 cresc = buildcycle( int, reverse out );
19 fill cresc withcolor 0.5white;
20 draw cresc withpen pencircle scaled 1pt;
21 endfig;
22
23 beginfig(2); % trapezio
24 numeric u, ind, esq[], rig[], h[], ch;
25 pair hlab[];
26 u = 0.55in;
27 ch = 0;
28 for ind=0 upto 4:
29 esq[ind] = -abs(((normaldeviate)-1.5)*u);
30 rig[ind] = abs(((normaldeviate)+1.5)*u);
31 h[ind] = (abs((normaldeviate)+0.25)*u/4)+2mm+ch;
32 ch := ch+h[ind];
33 endfor;
34 draw (esq0,h0)--(rig0,h0);
35 for ind=1 upto 4:
36 draw (esq[ind-1],h[ind-1])--(esq[ind],h[ind]);
37 draw (rig[ind-1],h[ind-1])--(rig[ind],h[ind]);
38 draw ((esq[ind],h[ind])--(rig[ind],h[ind])) dashed evenly;
39 hlab[ind] = (0,(h[ind]+h[ind-1])/2);
40 endfor;
41 draw (esq4,h4)--(rig4,h4);
42 draw ((0,h0)--(0,h4)) dashed evenly;
43 label.rt( btex $h_1$ etex, hlab1 );
44 label.rt( btex $h_2$ etex, hlab2 );
45 label.rt( btex $h_3$ etex, hlab3 );
46 label.rt( btex $h_4$ etex, hlab4 );
47 label.top( btex $l_0$ etex, ((rig0+esq0)/2,h0) );
48 label.top( btex $l_1$ etex, ((rig1+esq1)/2,h1) );
49 label.top( btex $l_2$ etex, ((rig2+esq2)/2,h2) );
50 label.top( btex $l_3$ etex, ((rig3+esq3)/2,h3) );
51 label.top( btex $l_4$ etex, ((rig4+esq4)/2,h4) );
52 endfig;
53
54 beginfig(3); % olimpiad
55 numeric u;
56 u=1in;
57 path squr, arcir, vert, horiz, area;
58 squr = unitsquare scaled u;
59 arcir = halfcircle scaled 2u;
60 vert = (origin--up) scaled u shifted (u/2,0);
61 horiz = (origin--right) scaled u shifted (0,u/2);\
62 area = buildcycle( vert, arcir, horiz );
63 fill area withcolor 0.5white;
64 draw area withpen pencircle scaled 1pt;
65 draw squr;
66 draw arcir cutafter squr;
67 draw vert;
68 draw horiz;
69 endfig;
70
71 beginfig(4); % ortoproj
72 numeric u;
73 u=1in;
74 draw unitsquare scaled u;
75 path one, two;
76 one = (0.5,0)--(0.5,0.5)--(1,1);
77 two = (0,1)--(0.5,0.5);
78 draw one scaled u;
79 draw two scaled u;
80 draw currentpicture shifted (0,1.5u);
81 endfig;
82
83 verbatimtex \end{document} etex
84
85 end;