Debian Codegraph @

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

raw
1 % fis3prex.mp
2 % L. Nobre G.
3 % 2004
4
5 input featpost3Dplus2D;
6
7 verbatimtex
8 \documentclass{article}
9 \usepackage{beton}
10 \usepackage{concmath}
11 \usepackage{ccfonts}
12 \begin{document}
13 etex
14
15 def platecap( expr Xpos, Shade, Angle, Oray, Iray, NumPoints ) =
16 begingroup
17 path perim, op, ip;
18 numeric i;
19 color axey, axmz, tp;
20 axey = cosd( Angle )*green + sind( Angle )*blue;
21 axmz = -cosd( Angle )*blue + sind( Angle )*green;
22 tp = Xpos*red;
23 op = rp( tp+Oray*axey )
24 for i=1 upto NumPoints:
25 ..rp(tp+Oray*(cosd(i*180/NumPoints)*axey+sind(i*180/NumPoints)*axmz))
26 endfor;
27 ip = rp( tp+Iray*axey )
28 for i=1 upto NumPoints:
29 ..rp(tp+Iray*(cosd(i*180/NumPoints)*axey+sind(i*180/NumPoints)*axmz))
30 endfor;
31 perim = op--reverse ip--cycle;
32 fill perim withcolor Shade;
33 draw perim
34 endgroup
35 enddef;
36
37 beginfig(1);
38 f := ( 4, 1, 2 );
39 numeric i, j, xsiz, ysiz, gstep, angl, vlen, fact, xa, xb, yb;
40 color vdir, bpos, ap, bp, cp, dp;
41 path base;
42 xsiz = 2;
43 ysiz = 3;
44 gstep = 0.23;
45 angl = 33;
46 vlen = 0.45;
47 fact = 1.3;
48 vdir = vlen*( 0, cosd(angl), sind(angl) );
49 xa = 0.5*gstep;
50 xb = (xsiz+0.5)*gstep;
51 yb = (ysiz+0.5)*gstep;
52 ap = (-xa,-xa,0);
53 bp = (-xa,yb,0);
54 cp = (xb,yb,0);
55 dp = (xb,-xa,0);
56 for i=0 upto xsiz:
57 for j=0 upto ysiz:
58 bpos := gstep*(i,j,0);
59 draw rp(bpos-fact*vdir)--rp(bpos);
60 drawarrow rp(bpos-fact*vdir)--rp(bpos-vdir);
61 endfor;
62 endfor;
63 base = rp(ap)--rp(bp)--rp(cp)--rp(dp)--cycle;
64 fill base withcolor 0.7background;
65 draw base;
66 for i=0 upto xsiz:
67 for j=0 upto ysiz:
68 bpos := gstep*(i,j,0);
69 draw rp(bpos+fact*vdir)--rp(bpos);
70 drawarrow rp(bpos)--rp(bpos+vdir);
71 endfor;
72 endfor;
73 draw rp(black)--rp( (0,0,vlen) ) dashed evenly;
74 angline( fact*vdir, (0,0,vlen), black, 0.7*vlen, btex 57$^\circ$ etex, urt );
75 label.top( btex $\vec{B}$ etex, rp(vdir) );
76 endfig;
77
78 beginfig(2);
79 f := ( 4, 3, 2 );
80 numeric i, numplates, xdelta, iangle, ang, oray, iray, numpois;
81 numeric aang, imray, omray, mmray, axray, numouts;
82 color shade, shadea, shadeb, p[];
83 path fucir, outerarrow, theknob;
84 numplates = 11;
85 numouts = 2;
86 xdelta = 0.1;
87 iangle = 53;
88 oray = 0.5;
89 iray = 0.07;
90 imray = 0.52;
91 omray = 0.67;
92 mmray = 0.64;
93 axray = 0.04;
94 numpois = 10;
95 shadea = 0.8background;
96 shadeb = 0.6background;
97 fucir = rigorouscircle( (-(numplates-1)*xdelta,0,0), red, imray );
98 outerarrow = subpath (1.7,2.3) of fucir;
99 p1 = ( -(numplates-1)*xdelta, imray, 0 );
100 p2 = ( -(numplates-1)*xdelta, omray, 0 );
101 p3 = ( -(numplates-2)*xdelta, imray, 0 );
102 p4 = ( -(numplates-2)*xdelta, omray, 0 );
103 p5 = ( -(numplates-4)*xdelta, mmray, 0 );
104 p6 = ( -(numplates-2)*xdelta, mmray, 0 );
105 p7 = ( -(numplates+1)*xdelta, mmray, 0 );
106 p8 = ( -(numplates-1)*xdelta, mmray, 0 );
107 p9 = ( -xdelta, cosd( 0.5*iangle )*0.5*oray, sind( 0.5*iangle )*0.5*oray );
108 p0 = ( 0, cosd( 0.5*iangle )*0.5*oray, -sind( 0.5*iangle )*0.5*oray );
109 for i=1-numplates upto 0:
110 if odd(i):
111 shade := shadea;
112 ang := iangle;
113 else:
114 shade := shadeb;
115 ang := 0;
116 fi;
117 platecap( i*xdelta, shade, ang, oray, iray, numpois );
118 background := shadea;
119 rigorousdisc( 0, true, (i*xdelta,0,0), axray, xdelta*red );
120 background := shadeb;
121 rigorousdisc( 0, true, (i*xdelta,-oray,0), axray, xdelta*red );
122 background := background;
123 endfor;
124 for i=1 upto numouts:
125 background := shadea;
126 rigorousdisc( 0, true, (i*xdelta,0,0), axray, xdelta*red );
127 % background := shadeb;
128 % rigorousdisc( 0, true, (i*xdelta,-oray,0), axray, xdelta*red );
129 endfor;
130 theknob = rigorousfearpath( ((numouts+1)*xdelta,0,0), 2*axray );
131 fill theknob;
132 draw theknob;
133 background := background;
134 draw rp(p1)--rp(p2);
135 draw rp(p3)--rp(p4);
136 drawarrow rp(p5)--rp(p6);
137 drawarrow rp(p7)--rp(p8);
138 drawarrow outerarrow;
139 label.ulft( btex $d$ etex, rp(p7) );
140 label( btex $A$ etex, rp(p9) );
141 label( btex $A$ etex, rp(p0) );
142 endfig;
143
144 beginfig(3);
145 f := ( 3, 2, 1 );
146 numeric oray, iray;
147 path opath, ipath;
148 color lRpos, Rpos, Ppos, zpos, rpos, spos;
149 oray = 0.5;
150 iray = 0.2oray;
151 opath = rigorouscircle( black, blue, oray );
152 ipath = rigorouscircle( black, blue, 0.2oray );
153 fill opath withcolor 0.7background;
154 fill ipath withcolor background;
155 draw opath;
156 draw ipath;
157 lRpos = ( oray, 0, 0 );
158 Rpos = 0.5lRpos;
159 Ppos = ( 0, 0, 2oray );
160 zpos = 0.5Ppos;
161 rpos = ( 0, iray, 0 );
162 spos = -Rpos;
163 drawarrow rp(black)--rp(lRpos);
164 drawarrow rp(black)--rp(Ppos);
165 drawarrow rp(black)--rp(rpos);
166 dotlabel.lft( btex $P$ etex, rp(Ppos) );
167 label.rt( btex $z$ etex, rp(zpos) );
168 label.ulft( btex $R$ etex, rp(Rpos) );
169 label.lrt( btex $r$ etex, rp(rpos) );
170 label( btex $\sigma$ etex, rp(spos) );
171 endfig;
172
173 beginfig(4);
174 f := ( 3, 4, 2 );
175 numeric raya, rayb, rayc, lena, lenb;
176 color baseac, baseav, basebc, basebv, rayabbeg, rayabend, lambdapos;
177 raya = 0.017;
178 rayb = 0.1;
179 rayc = 0.2;
180 lena = 1.4;
181 lenb = 0.6;
182 baseac = 0.5*lena*red;
183 baseav = -lena*red;
184 basebc = 0.5*lenb*red;
185 basebv = -lenb*red;
186 rayabbeg = ( 0.5*lenb, raya, 0 );
187 rayabend = ( 0.5*lenb, rayc, 0 );
188 lambdapos = ( 0, rayc, 0 );
189 rigorousdisc( 0, true, basebc, rayc, basebv );
190 rigorousdisc( 0, true, baseac, raya, baseav );
191 rigorousdisc( 0, false, basebc, rayc, basebv );
192 drawarrow rp( rayabbeg )--rp( rayabend );
193 label.bot( btex $R$ etex, rp( 0.5[rayabbeg,rayabend] ) );
194 label( btex $\lambda_t$ etex, rp ( lambdapos ) );
195 label.lrt( btex $\lambda_f$ etex, rp( 0.3[baseac,basebc] ) );
196 endfig;
197
198 beginfig(5);
199 f := ( 5, 5, 3 );
200 numeric i, numpoints, ray, aux, blen, bang, fa, fb, fc, fd;
201 path wirea, wireb, wirec, wired, wirepath;
202 color wa[], wb[], btip, xpos;
203 pen bigpen, smallpen;
204 numpoints = 36;
205 ray = 0.5;
206 blen = 0.8;
207 fa = -1.1;
208 fb = -0.8;
209 fc = -fb;
210 fd = -fa;
211 bang = -45;
212 btip = blen*(0,cosd( bang ), sind( bang ) );
213 for i=1 upto numpoints:
214 aux := i*180/numpoints;
215 wa[i] = ray*(red*cosd(aux)+green*sind(aux));
216 % drawarrow rp( wa[i] )--rp( wa[i]+btip );
217 wb[i] = ray*(-red*cosd(aux)-blue*sind(aux));
218 % drawarrow rp( wb[i] )--rp( wb[i]+btip );
219 endfor;
220 wirepath = for i=1 upto numpoints:
221 rp( wa[i] )-- endfor for i=1 upto numpoints:
222 rp( wb[i] )-- endfor cycle;
223 bigpen = pencircle scaled 3pt;
224 smallpen = pencircle scaled 2.2pt;
225 draw wirepath withpen bigpen;
226 wirea = rp( wb[numpoints] ) for i=1 upto numpoints:
227 --rp( wa[i] ) endfor;
228 wireb = rp( wa[numpoints] ) for i=1 upto numpoints:
229 --rp( wb[i] ) endfor;
230 wirec = rp( wb[numpoints-1] )--wirea--rp( wb[1] );
231 % wired = rp( wa[numpoints-1] )--wireb--rp( wa[1] );
232 draw wireb withpen smallpen withcolor background;
233 % cartaxes( 2ray, 2ray, 1.2ray );
234 draw rp( 2*ray*red )--rp( -2*ray*red ) dashed evenly;
235 draw rp( black )--rp( -ray*blue );
236 draw rp( black )--rp( ray*green );
237 for i=-1 upto 1:
238 xpos := (i*ray,0,0);
239 drawarrow rp( xpos+fa*btip )--rp( xpos+fb*btip );
240 drawarrow rp( xpos+fb*btip )--rp( xpos+fc*btip );
241 draw rp( xpos+fc*btip )--rp( xpos+fd*btip );
242 endfor;
243 squareangline( -ray*blue, ray*green, black, 0.1*ray);
244 draw wirea withpen bigpen;
245 draw wirec withpen smallpen withcolor background;
246 label.urt( btex $\vec{B}$ etex, rp( btip ) );
247 endfig;
248
249 beginfig(6);
250 path baset, sphere;
251 color va, vb, vc, qpos;
252 va = (0,0,0);
253 vb = (0.5,0.5*sqrt(3),0);
254 vc = (-0.5,0.5*sqrt(3),0);
255 baset = rp( va )--rp( vb )--rp( vc )--cycle;
256 draw baset;
257 qpos = (0,0.333*sqrt(3),0.333*sqrt(1-0.333*sqrt(3)) );
258 sphere = rigorousfearpath( qpos, 0.1 );
259 fill sphere withcolor background;
260 draw sphere;
261 label( btex +$q$ etex, rp( qpos ) );
262 endfig;
263
264 beginfig(7);
265 Spread := 50;
266 f := (4,6,3.5);
267 path fiodecima, fioabaixo, malhacub, rama, ramb, ramc;
268 path malhatet, ramd, rame;
269 pen grossa, nuclear, negat;
270 color p[];
271 numeric altura, margem, largneg, largpos, afast, lengax, lscal;
272 pair topo, base, decima, abaixo, centerfont, centerneg, centerpos;
273 pair a, b, c, d, tx, ty, tz;
274 altura = 2cm;
275 margem = 3mm;
276 largneg = 9mm;
277 largpos = 18mm;
278 afast = 5cm;
279 lengax = 0.7;
280 lscal = 2;
281 grossa = pencircle scaled 2.7pt;
282 nuclear = pencircle scaled 2.1pt;
283 negat = pencircle scaled 1.8pt;
284 p1 = (1,1,-1);
285 p2 = (-1,1,-1);
286 p3 = (-1,-1,-1);
287 p4 = (1,-1,-1);
288 p5 = (1,1,1);
289 p6 = (-1,1,1);
290 p7 = (-1,-1,1);
291 p8 = (1,-1,1);
292 p0 = (0,0,1);
293 p9 = (0,0,-1);
294 z1 = rp(p1);
295 z2 = rp(p2);
296 z3 = rp(p3);
297 z4 = rp(p4);
298 z5 = rp(p5);
299 z6 = rp(p6);
300 z7 = rp(p7);
301 z8 = rp(p8);
302 z0 = rp(p0);
303 z9 = rp(p9);
304 tx = rp( p1 - (lengax,0,0) );
305 ty = rp( p1 - (0,lengax,0) );
306 tz = rp( p1 + (0,0,lengax) );
307 topo = (xpart z0, altura + ypart z0);
308 base = (xpart z9, -altura + ypart z9);
309 decima = (afast + xpart topo, ypart topo);
310 abaixo = (afast + xpart base, ypart base);
311 centerfont = 0.5*(decima+abaixo);
312 centerpos = (xpart centerfont, 0.5*margem + ypart centerfont);
313 centerneg = (xpart centerfont, -0.5*margem + ypart centerfont);
314 fiodecima = z0--topo--decima--centerpos;
315 fioabaixo = z9--base--abaixo--centerneg;
316 a = ( -0.5*largpos + xpart centerfont, ypart centerpos);
317 b = ( 0.5*largpos + xpart centerfont, ypart centerpos);
318 c = ( -0.5*largneg + xpart centerfont, ypart centerneg);
319 d = ( 0.5*largneg + xpart centerfont, ypart centerneg);
320 malhacub = z1--z2--z3--z4--z1--z5--z6--z7--z8--z5;
321 malhatet = z2--z7--z4--z5--cycle;
322 rama = z2--z6;
323 ramb = z3--z7;
324 ramc = z4--z8;
325 ramd = z5--z7;
326 rame = z2--z4;
327 drawoptions( dashed evenly );
328 draw malhacub;
329 draw rama;
330 draw ramb;
331 draw ramc;
332 drawoptions( withpen grossa );
333 draw malhatet;
334 draw ramd;
335 draw rame;
336 % drawoptions( withpen nuclear withcolor background );
337 % draw malhatet;
338 % draw ramd;
339 % draw rame;
340 drawoptions();
341 draw fiodecima;
342 draw fioabaixo;
343 draw a--b;
344 drawarrow z1--tx withpen negat;
345 drawarrow z1--ty withpen negat;
346 drawarrow z1--tz withpen negat;
347 label.lrt(btex $x$ etex scaled lscal, tx);
348 label.llft(btex $y$ etex scaled lscal, ty);
349 label.lft(btex $z$ etex scaled lscal, tz);
350 linecap := butt;
351 draw c--d withpen negat;
352 endfig;
353
354 beginfig(8);
355 Spread := 50;
356 f := (6,6,3.5);
357 numeric squareside, sray, cdiameter, cray, distmargin, linemargin, eloing;
358 squareside = 1;
359 cdiameter = squareside/0.88623;
360 cray = cdiameter/2.0;
361 sray = squareside/2.0;
362 distmargin = 0.5;
363 linemargin = 0.15;
364 eloing = 0.4;
365 pen pena, penb, penc;
366 pena = pencircle scaled 1.3mm;
367 penb = pencircle scaled 0.95mm;
368 penc = pencircle scaled 0.4mm;
369 color tracecol, outcol, incol;
370 tracecol = 0.5white;
371 outcol = black;
372 incol = 0.876white;
373 color va, vb, vc, vd, cen, bs, bc, fs, fc, ds, dc;
374 va = (0,-sray,-sray);
375 vb = (0,sray,-sray);
376 vc = (0,sray,sray);
377 vd = (0,-sray,sray);
378 cen = (-distmargin,0,0);
379 bs = (0,-sray-linemargin,0);
380 bc = bs+cen;
381 fs = (0,sray+eloing,0);
382 ds = (0,sray+eloing-linemargin,0);
383 fc = fs+cen;
384 dc = ds+cen;
385 path rigcirc, carrpath, square, circ, sline, cline, dline;
386 square = rp(va)--rp(vb)--rp(vc)--rp(vd)--cycle;
387 circ = goodcirclepath( cen, red, cray );
388 rigcirc = rigorouscircle( cen, red, cray+linemargin );
389 carrpath = subpath (1,2) of rigcirc;
390 sline = rp(bs)--rp(fs);
391 cline = rp(bc)--rp(fc);
392 dline = rp(ds)--rp(dc);
393
394 draw cline withpen penc withcolor tracecol;
395 draw circ withpen pena withcolor outcol;
396 draw circ withpen penb withcolor incol;
397 draw sline withpen penc withcolor tracecol;
398 draw square withpen pena withcolor outcol;
399 draw square withpen penb withcolor incol;
400 drawdblarrow dline withpen penc withcolor tracecol;
401
402 pair begsarr, endsarr;
403 begsarr = rp((0,-sray-linemargin,linemargin));
404 endsarr = rp((0,-sray-linemargin,sray));
405 drawarrow begsarr--endsarr withpen penc withcolor tracecol;
406 drawarrow carrpath withpen penc withcolor tracecol;
407
408 label.lft( btex $I$ etex, rp((0,-sray-linemargin,sray-linemargin)) );
409 label.top( btex $+$ etex, point 1.5 of rigcirc );
410 label.top( btex $d$ etex, rp(dc) );
411 endfig;
412
413 beginfig(9);
414 Spread := 50;
415 f := (6,6,3.5);
416 numeric squareside, sray, cdiameter, cray, distmargin, linemargin, eloing;
417 squareside = 1;
418 cdiameter = squareside/0.88623;
419 cray = cdiameter/2.0;
420 sray = squareside/2.0;
421 distmargin = 0.5;
422 linemargin = 0.15;
423 eloing = 0.4;
424 pen pena, penb, penc;
425 pena = pencircle scaled 1.3mm;
426 penb = pencircle scaled 0.95mm;
427 penc = pencircle scaled 0.4mm;
428 color tracecol, outcol, incol;
429 tracecol = 0.5white;
430 outcol = black;
431 incol = 0.876white;
432 color va, vb, vc, vd, cen, bs, bc, fs, fc, ds, dc, os, oc, ncc;
433 va = (0,-sray,-sray);
434 vb = (0,sray,-sray);
435 vc = (0,sray,sray);
436 vd = (0,-sray,sray);
437 cen = (-distmargin,0,0);
438 bs = (0,-sray-linemargin,0);
439 bc = bs+cen;
440 fs = (0,sray+eloing,0);
441 ds = (0,sray+eloing-linemargin,0);
442 fc = fs+cen;
443 dc = ds+cen;
444 os = (linemargin,sray,0);
445 oc = (-distmargin-cdiameter-linemargin,sray,0);
446 ncc = (-distmargin-cray,sray,0);
447 path rigcirc, carrpath, square, circ, sline, cline, dline, oline;
448 square = rp(va)--rp(vb)--rp(vc)--rp(vd)--cycle;
449 circ = goodcirclepath( ncc, green, cray );
450 rigcirc = rigorouscircle( ncc, green, cray+linemargin );
451 carrpath = subpath (3,4) of rigcirc;
452 sline = rp(bs)--rp(fs);
453 cline = rp(bc)--rp(fc);
454 dline = rp(ds)--rp(dc);
455 oline = rp(os)--rp(oc);
456
457 draw oline withpen penc withcolor tracecol;
458 draw cline withpen penc withcolor tracecol;
459 draw circ withpen pena withcolor outcol;
460 draw circ withpen penb withcolor incol;
461 draw sline withpen penc withcolor tracecol;
462 draw square withpen pena withcolor outcol;
463 draw square withpen penb withcolor incol;
464 drawdblarrow dline withpen penc withcolor tracecol;
465
466 pair begsarr, endsarr;
467 begsarr = rp((0,-sray-linemargin,linemargin));
468 endsarr = rp((0,-sray-linemargin,sray));
469 drawarrow begsarr--endsarr withpen penc withcolor tracecol;
470 drawarrow carrpath withpen penc withcolor tracecol;
471
472 label.lft( btex $I$ etex, rp((0,-sray-linemargin,sray-linemargin)) );
473 label.top( btex $+$ etex, point 3.5 of rigcirc );
474 label.bot( btex $d$ etex, rp(dc) );
475 endfig;
476
477 verbatimtex
478 \end{document}
479 etex
480
481 end;