Debian Codegraph @

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

raw
1 % newcommunism.mp
2 % L. Nobre G.
3 % 2007
4
5 prologues := 2;
6
7 beginfig(1);
8 numeric u, elhei, elwid, elpos, bawid, bahei, thstp, thdel, i;
9 numeric refang, reft, tfin, tini, spikang;
10 path el, ba, aux, cutel, horns;
11 pair reftpair;
12 color yellow, thered;
13 yellow = 0.87*(0.95*red+0.7*green);
14 thered = 0.66red;
15 u = 2mm;
16 thdel = 25;
17 thstp = 5;
18 elhei = 30u;
19 elwid = 44u;
20 elpos = 26u;
21 bawid = 27u;
22 bahei = 10u;
23 el = (elwid,elpos)..for i=thstp step thstp until 360-thstp:
24 (elwid*cosd(i),elpos+elhei*sind(i)).. endfor cycle;
25 ba = (bawid,-bahei){right}..{left}(bawid,0)--
26 (elwid*cosd(90-thdel),elpos+elhei*sind(90-thdel))--
27 (bawid/3.0,0)--(0,elpos+elhei)--(-bawid/3.0,0)--
28 (elwid*cosd(90+thdel),elpos+elhei*sind(90+thdel))--
29 (-bawid,0){left}..{right}(-bawid,-bahei)--cycle;
30 aux = (0,elpos)--
31 1.1[(0,elpos),(elwid*cosd(270+2thdel),elpos+elhei*sind(270+2thdel))];
32 reftpair = el intersectiontimes aux;
33 reft = xpart reftpair;
34 refang = angle( direction reft of el );
35 tfin = directiontime dir(180-refang) of el;
36 tini = directiontime dir(180+refang) of el - length el;
37 cutel = subpath (tini,tfin) of el;
38 spikang = (90-angle((0,elpos+elhei)-(-bawid,0)));
39 horns = cutel{dir(-refang-spikang)}..
40 {left}(0,elpos-elhei+bawid/3.0)..
41 {dir(refang+spikang)}cycle;
42 fill ba withcolor yellow;
43 fill horns withcolor yellow;
44 picture storepic;
45 storepic = currentpicture;
46 currentpicture := nullpicture;
47 bboxmargin := bahei;
48 fill bbox storepic withcolor thered;
49 draw storepic;
50 endfig;
51
52 beginfig(2);
53 numeric u;
54 color yellow, thered;
55 path martelo, foice, monitor, ecran, mar, foi;
56 u = 1pt;
57 % yellow = 0.87*(0.95*red+0.7*green);
58 thered = 0.66red;
59 yellow = 0.7blue;
60 picture storemf;
61
62 numeric cabosal, cabesal, cabolar, cabelar;
63 numeric cabolen, cabeclen, cabecontrol, martelrot;
64 pair martelpos;
65 cabosal = 2u;
66 cabesal = 6u;
67 cabolar = 8u;
68 cabelar = 10u;
69 cabolen = 70u;
70 cabeclen = 7u;
71 cabecontrol = 4u;
72 martelrot = 50;
73 martelpos = dir(180)*0.03*cabolen;
74 z100 = origin;
75 z101 = ( cabesal, 0 );
76 z102 = ( cabesal, cabosal+cabelar-cabolen );
77 z103 = ( cabesal+cabolar, cabosal+cabelar-cabolen );
78 z104 = ( cabesal+cabolar, 0 );
79 z105 = ( cabesal+cabolar+cabeclen, 0 );
80 z106 = ( cabesal+cabolar+cabecontrol, cabelar );
81 z107 = ( cabesal+cabolar, cabelar );
82 z108 = ( cabesal+cabolar, cabelar+cabosal );
83 z109 = ( cabesal, cabelar+cabosal );
84 z110 = ( cabesal, cabelar );
85 z111 = ( 0, cabelar );
86 martelo = z100--
87 z101--
88 z102--
89 z103--
90 z104--
91 z105..controls z106..
92 z107--
93 z108--
94 z109--
95 z110--
96 z111--cycle;
97 mar = martelo
98 rotated martelrot
99 shifted martelpos;
100
101 filldraw mar withcolor yellow;
102 show mar;
103 numeric fcabolen, fcabolar, foicecontrol, laminang;
104 numeric foicerot, foicaber, flamilar, fcabomar, refang;
105 numeric fmaomarg, fmaorais, fmaospac, fprotrud, basangul;
106 pair foicepos;
107 laminang = 3;
108 refang = 10
109 basangul = 23;
110 fcabomar = 3u;
111 fcabolar = 8u - fcabomar;
112 flamilar = 4u;
113 fcabolen = 22u;
114 foicecontrol = 2u;
115 fmaomarg = 6u;
116 fmaorais = 2u;
117 fmaospac = 14u;
118 fprotrud = 30u;
119 foicaber = 42u;
120 foicerot = -50;
121 foicepos = dir(270)*0.3*foicaber;
122 z200 = origin;
123 z201 = ( -fcabomar, 0 );
124 z202 = ( -fcabomar, -fcabolen );
125 z203 = ( fcabolar, -fcabolen );
126 z204 = ( fcabolar+foicecontrol, -fcabolen );
127 z205 = ( fcabolar+fmaomarg, fmaorais-fmaospac );
128 z206 = ( fcabolar, -fmaospac );
129 z207 = ( fcabolar, 0 );
130 z208 = ( -fprotrud, foicaber );
131 z209 = ( 0, flamilar );
132 foice = z200--
133 z201--
134 z202--
135 z203..controls z204..
136 z205{dir(-160)}..{left}
137 z206--
138 z207{dir(basangul)}..tension 0.8..{dir(180+refang+laminang)}
139 z208{dir(refang-laminang)}..tension 0.8..{dir(180+basangul)}
140 z209--cycle;
141 foi = foice
142 rotated foicerot
143 shifted foicepos;
144
145 filldraw foi withcolor yellow;
146 show foi;
147 storemf = currentpicture shifted -(center currentpicture);
148 currentpicture := nullpicture;
149
150
151
152
153
154
155 numeric monith, monitw;
156 pair mll, mlr, mur, mul;
157 monith = 18u + ypart ((urcorner storemf)-(llcorner storemf));
158 monitw = 1.34monith;
159 mll = (-0.5monitw, -0.5monith);
160 mlr = (0.5monitw, -0.5monith);
161 mur = (0.5monitw, 0.5monith);
162 mul = (-0.5monitw, 0.5monith);
163 ecran = mll--
164 mlr--
165 mur--
166 mul--cycle;
167
168 numeric bordthick, roundfrac, alturpe, borraspac, largupe;
169 numeric borralarg, apoiolarg, cornermarg, apoiothick;
170 bordthick = 13u;
171 roundfrac = 0.3;
172 alturpe = 15u;
173 borraspac = 0.95u;
174 largupe = 50u;
175 borralarg = 60u;
176 apoiolarg = 156u;
177 cornermarg = 2u;
178 apoiothick = 18u;
179 z301 = (0.5largupe,-0.5monith-bordthick);
180 z302 = (0.5monitw+roundfrac*bordthick,-0.5monith-bordthick);
181 z303 = (0.5monitw+bordthick,-0.5monith-roundfrac*bordthick);
182 z304 = (0.5monitw+bordthick,0.5monith+roundfrac*bordthick);
183 z305 = (0.5monitw+roundfrac*bordthick,0.5monith+bordthick);
184 z306 = (-0.5monitw-roundfrac*bordthick,0.5monith+bordthick);
185 z307 = (-0.5monitw-bordthick,0.5monith+roundfrac*bordthick);
186 z308 = (-0.5monitw-bordthick,-0.5monith-roundfrac*bordthick);
187 z309 = (-0.5monitw-roundfrac*bordthick,-0.5monith-bordthick);
188 z310 = (-0.5largupe,-0.5monith-bordthick);
189 z311 = (-0.5largupe,-0.5monith-bordthick-alturpe);
190 z312 = (-0.5apoiolarg+cornermarg,
191 -0.5monith-bordthick-alturpe-cornermarg);
192 z313 = (-0.5apoiolarg,
193 -0.5monith-bordthick-alturpe-apoiothick-borraspac);
194 z314 = (-0.5borralarg,
195 -0.5monith-bordthick-alturpe-apoiothick-borraspac);
196 z315 = (0,-0.5monith-bordthick-alturpe-apoiothick);
197 z316 = (0.5borralarg,
198 -0.5monith-bordthick-alturpe-apoiothick-borraspac);
199 z317 = (0.5apoiolarg,
200 -0.5monith-bordthick-alturpe-apoiothick-borraspac);
201 z318 = (0.5apoiolarg-cornermarg,
202 -0.5monith-bordthick-alturpe-cornermarg);
203 z319 = (0.5largupe,-0.5monith-bordthick-alturpe);
204 monitor = z301--
205 z302{right}..{up}
206 z303--
207 z304{up}..{left}
208 z305--
209 z306{left}..{down}
210 z307--
211 z308{down}..{right}
212 z309--
213 z310--
214 z311..controls z312..
215 z313--
216 z314{dir(73)}...{right}
217 z315{right}...{dir(-73)}
218 z316--
219 z317..controls z318..
220 z319--cycle;
221 draw monitor withcolor thered;
222 bboxmargin := monitw;
223 fill bbox monitor withcolor thered;
224 filldraw monitor withcolor yellow;
225 filldraw ecran withcolor thered;
226 show monitor;
227 show ecran;
228 % label.urt("New Communism", llcorner monitor);
229 draw storemf;
230
231
232 endfig;
233
234
235 end;
236
237