Debian Codegraph @

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

raw
1 % mypatent.mp
2 % L. Nobre G.
3 % IYP (2005)
4
5 input featpost3Dplus2D;
6
7 verbatimtex
8 \documentclass[12pt]{article}
9 \usepackage{courier}
10 \begin{document}
11 {\ttfamily
12 etex
13
14 vardef P@# = rp(V@#) enddef;
15
16 picture pecaa, pecab, pecabe;
17
18 f := 2*(14,5,10);
19 Spread := 36;
20 ahangle := 30;
21 ahlength := 1.8mm;
22
23 pen pendot, penedge, pendist;
24 penedge= pencircle scaled 1pt;
25 pendot = pencircle scaled 1.7pt;
26 pendist= pencircle scaled 0.4pt;
27
28 numeric u, marg, leves, elast;
29 u = 0.1;
30 marg = 16u;
31 %leves = 410;
32 leves = 22u;
33 elast = 1u;
34
35 vardef elastf( expr Ca, Cb ) = Cb + N( Cb-Ca )*elast enddef;
36
37 V1 := (0,0,0);
38 V2 := (0,0,4u);
39 V3 := (0,16u,4u);
40 V4 := (4u,16u,4u);
41 V5 := (4u,16u,8u);
42 V6 := (0,16u,8u);
43 V7 := (0,24u,16u);
44 V8 := (4u,24u,16u);
45 V9 := (4u,35u,4u);
46 V10:= (4u,35u,0);
47 V11:= (16u,23u,0);
48 V12:= (16u,23u,4u);
49 V13:= (16u,0,4u);
50 V14:= (16u,0,0);
51 V15:= (0,43u,8u);
52 V16:= (4u,43u,8u);
53 V17:= (8u,8u,0);
54 V18:= (4u,43u,16u);
55 V19:= (0,43u,16u);
56
57 beginfig(1);
58 path pat[];
59 pat1 = P3--P2--P13--P14--P11--P10--P9--P12--P13;
60 pat2 = P11--P12;
61 pat3 = P9--P4--P5--P6--P7--P8--P5;
62 numeric i;
63 pat8 = P1-- for i=-90 step 5 until 85:
64 rp(V15+(0,8u*cosd(i),8u*sind(i)))..
65 endfor P19--P7;
66 pat5 = P10-- for i=-90 step 5 until 85:
67 rp(V16+(0,8u*cosd(i),8u*sind(i)))..
68 endfor P18--P8;
69 pat6 = pat1 cutbefore pat3;
70 pair auxp,auxP;
71 auxp = point 0 of spatialhalfcircle(V15,red,8.05u,true);
72 auxP = point 0 of spatialhalfcircle(V16,red,8.05u,true);
73 pat9 = rp(V15)--auxp;
74 pat4 = pat8 cutbefore pat9;
75 pat7 = auxp--auxP;
76 drawoptions( withpen penedge );
77 for i=2 upto 7:
78 draw pat[i];
79 endfor;
80 fakehole(V15,red*4u, 2u );
81 fakehole(V17,blue*4u, 2u );
82 pecab = currentpicture;
83 endfig;
84
85 beginfig(2);
86 numeric i;
87 for i=1 upto 19:
88 V[i+100] := (X(V[i]),-Y(V[i]),Z(V[i]))-(0,marg,0);
89 endfor;
90 path pat[];
91 pat1 = P109--P112--P113--P102--P101--P114--P111--P110--P109--P104--P103
92 --P106--P107--P108--P105--P104;
93 pat2 = P105--P106;
94 pat3 = P113--P114;
95 pat4 = P111--P112;
96 pat5 = P102--P103;
97 pat10 = P101-- for i=-90 step 5 until 85:
98 rp(V115+(0,-8u*cosd(i),8u*sind(i)))..
99 endfor P119--P107;
100 pat6 = P110-- for i=-90 step 5 until 85:
101 rp(V116+(0,-8u*cosd(i),8u*sind(i)))..
102 endfor P118--P108;
103 pair auxp,auxP;
104 auxp = point 0 of spatialhalfcircle(V115,red,8.05u,false);
105 auxP = point 0 of spatialhalfcircle(V116,red,8.05u,false);
106 pat9 = P115--auxp;
107 pat8 = pat10 cutbefore pat9;
108 pat7 = auxp--auxP;
109 drawoptions( withpen penedge );
110 for i=1 upto 8:
111 draw pat[i];
112 endfor;
113 fakehole(V115,red*4u, 2u );
114 fakehole(V117,blue*4u, 2u );
115 pecabe = currentpicture;
116 % draw pecab;
117 endfig;
118
119 beginfig(3);
120 V21:= (24u+marg,0,0);
121 V22:= (X(V21),Y(V115)+16u,0);
122 V23:= (X(V21),Y(V15)-16u,0);
123 V24:= (X(V21),Y(V115),0);
124 V25:= (X(V21),Y(V15),0);
125 V26:= (X(V21),Y(V115),4u);
126 V27:= (X(V21),Y(V15),4u);
127 V28:= (X(V21),Y(V115)+16u,4u);
128 V29:= (X(V21),Y(V15)-16u,4u);
129 path pat[];
130 pat1 = for i=-90 step 2 until 90:
131 rp(V22+(2u*sind(i),-2u*cosd(i),0))...
132 endfor
133 for i=-90 step 2 until 90:
134 rp(V23+(2u*sind(-i),2u*cosd(i),0))...
135 endfor
136 cycle;
137 pat2 = for i=-90 step 2 until 90:
138 rp(V28+(2u*sind(i),-2u*cosd(i),0))...
139 endfor
140 for i=-90 step 2 until 90:
141 rp(V29+(2u*sind(-i),2u*cosd(i),0))...
142 endfor
143 cycle;
144 pat3 = for i=-90 step 2 until 90:
145 rp(V24+(8u*sind(i),-8u*cosd(i),0))...
146 endfor
147 for i=-90 step 2 until 90:
148 rp(V25+(8u*sind(-i),8u*cosd(i),0))...
149 endfor
150 cycle;
151 pat4 = for i=-90 step 2 until 90:
152 rp(V26+(8u*sind(i),-8u*cosd(i),0))...
153 endfor
154 for i=-90 step 2 until 90:
155 rp(V27+(8u*sind(-i),8u*cosd(i),0))...
156 endfor
157 cycle;
158 pair auxp, auxP, auxm, auxM;
159 auxp = point 0 of spatialhalfcircle(V24,blue,8.05u,true);
160 auxP = point 0 of spatialhalfcircle(V26,blue,8.05u,true);
161 auxm = point 0 of spatialhalfcircle(V25,blue,8.05u,false);
162 auxM = point 0 of spatialhalfcircle(V27,blue,8.05u,false);
163 pat5 = P24--auxp;
164 pat6 = P25--auxm;
165 pat7 = pat3 cutbefore pat5 cutafter pat6;
166 pat8 = auxp--auxP;
167 pat9 = auxm--auxM;
168 drawoptions( withpen penedge );
169 % draw pat1;
170 draw pat2;
171 draw pat7;
172 draw pat4;
173 draw pat8;
174 draw pat9;
175 fakehole(V24,blue*4u, 2u );
176 fakehole(V25,blue*4u, 2u );
177 pecaa = currentpicture;
178 % draw pecab;
179 % draw pecabe;
180 endfig;
181
182 beginfig(4);
183 V31:= V26-(5u,0,0);
184 V32:= 0.25*(V105+V106+V107+V108);
185 V33:= 0.25*(V5+V6+V7+V8);
186 pair paa, pab, pabe, angs, pn[];
187 numeric anxy, angz;
188 color veca, vecb, auxc, vecc;
189 angs = getanglepair( f-viewcentr );
190 anxy = xpart angs;
191 angz = ypart angs;
192 vecb = eulerrotation( anxy, angz+85.5, 0, red );
193 veca = eulerrotation( anxy, angz+83.5, 0, red );
194 vecc = eulerrotation( anxy, angz+93, 0, red );
195 drawoptions( withpen pendist );
196 pn2 = rp( lineintersectplan( V26, blue, f, vecb ) );
197 draw P26--pn2;
198 label.top( btex 3 etex, pn2 );
199 pn3 = rp( lineintersectplan( V27, blue, f, vecc ) );
200 draw P27--pn3;
201 label.top( btex 3' etex, pn3 );
202 auxc = 0.65[V26,V27];
203 pn4 = rp( lineintersectplan( auxc, blue, f, vecb ) );
204 draw rp(auxc)--pn4;
205 label.top( btex 4 etex, pn4 );
206 pn5 = rp( lineintersectplan( V116, blue, f, vecb ) );
207 draw P116--pn5;
208 label.top( btex 5 etex, pn5 );
209 pn6 = rp( lineintersectplan( V117+(0,0,4u), blue, f, vecb ) );
210 draw rp(V117+(0,0,4u))--pn6;
211 label.top( btex 6 etex, pn6 );
212 pn7 = rp( lineintersectplan( 0.25*(V103+V104+V105+V106), blue, f, vecb ) );
213 draw rp(0.25*(V103+V104+V105+V106))--pn7;
214 label.top( btex 7 etex, pn7 );
215 pn8 = rp( lineintersectplan( 0.5*(V102+V117+(0,0,4u)), blue, f, vecb ) );
216 draw rp(0.5*(V102+V117+(0,0,4u)))--pn8;
217 label.top( btex 8 etex, pn8 );
218
219
220 % paa = rp((X(V31),Y(V31),leves));
221 % pab = rp((X(V33),Y(V33),leves));
222 % pabe= rp((X(V32),Y(V32),leves));
223 paa = rp( lineintersectplan( V31, blue, f, veca ) );
224 pab = rp( lineintersectplan( V33, blue, f, veca ) );
225 pabe= rp( lineintersectplan( V32, blue, f, veca ) );
226 drawoptions( withpen pendot );
227 draw P31;
228 draw P32;
229 draw P33;
230 draw paa;
231 draw pab;
232 draw pabe;
233 drawoptions( withpen pendist );
234 draw P31--paa;
235 draw P32--pabe;
236 draw P33--pab;
237 label.top( btex 1 etex, paa );
238 label.top( btex 2 etex, pabe );
239 label.top( btex 2' etex, pab );
240 % draw pecaa;
241 % draw pecab;
242 % draw pecabe;
243 V34:= V26+(marg,0,0);
244 V35:= V27+(marg,0,0);
245 V36:= elastf(V26,V34 );
246 V37:= elastf( V27,V35 );
247 V38:= V27+(8u,0,0);
248 V39:= V25+(8u,0,0);
249 V40:= V27-(8u,0,0);
250 V41:= V38+(0,marg,0);
251 V42:= V39+(0,marg,0);
252 V43:= V40+(0,marg,0);
253 V44:= elastf( V38,V41 );
254 V45:= elastf( V39,V42 );
255 V46:= elastf( V40,V43 );
256 V47:= 0.5[V34,V35];
257 V48:= 0.5[V41,V42];
258 V49:= 0.5[V41,V43];
259 draw P26--P36;
260 draw P27--P37;
261 draw P38--P44;
262 draw P39--P45;
263 draw P40--P46;
264 drawdblarrow P34--P35;
265 drawdblarrow P41--P42;
266 drawdblarrow P41--P43;
267 label.bot( btex C etex, P47 );
268 label.rt( btex E etex, P48 );
269 label.rt( btex L etex, P49 );
270 V50:= V109 - (0,4u,0);
271 V51:= V115 + (4u,0,0);
272 V52:= V51 + (0,4u,0);
273 V53:= elastf( V109,V50 );
274 V54:= elastf( V51,V52 );
275 V55:= (8u,8u,4u);
276 V56:= (8u,8u,8u);
277 V57:= elastf( V55,V56 );
278 V58:= V15+(4u,0,0);
279 V59:= V58+(4u,0,0);
280 V60:= elastf( V58,V59 );
281
282
283 drawoptions( withpen penedge );
284 draw pecaa;
285 draw pecab;
286 draw pecabe;
287 drawoptions( withpen pendist );
288 draw P109--P53;
289 draw P51--P54;
290 drawdblarrow P50--P52;
291 label.rt( btex E etex, 0.5[P52,P50] );
292 draw P55--P57;
293 draw P58--P60;
294 drawdblarrow P56--P59;
295 label.top( btex D etex, 0.5[P56,P59] );
296
297 endfig;
298
299 verbatimtex
300 }
301 \end{document}
302 etex
303
304 end;
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319