summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/standard/fis3prex.mp
blob: 0fbc862c3b2ad4da7c39c38510dd25509949f04f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
% fis3prex.mp
% L. Nobre G. 
% 2004

%input featpost3Dplus2D;

verbatimtex
\documentclass{article}
\usepackage{beton}
\usepackage{concmath}
\usepackage{ccfonts}
\begin{document}
etex

def platecap( expr Xpos, Shade, Angle, Oray, Iray, NumPoints ) =
  begingroup
    path perim, op, ip;
    numeric i;
    color axey, axmz, tp;
    axey = cosd( Angle )*green + sind( Angle )*blue;
    axmz = -cosd( Angle )*blue + sind( Angle )*green;
    tp = Xpos*red;
    op = rp( tp+Oray*axey )
      for i=1 upto NumPoints:
      ..rp(tp+Oray*(cosd(i*180/NumPoints)*axey+sind(i*180/NumPoints)*axmz))
      endfor;
    ip = rp( tp+Iray*axey )
      for i=1 upto NumPoints:
      ..rp(tp+Iray*(cosd(i*180/NumPoints)*axey+sind(i*180/NumPoints)*axmz))
      endfor;
    perim = op--reverse ip--cycle;
    fill perim withcolor Shade;
    draw perim
  endgroup
enddef;
    
beginfig(1); 
  f := ( 4, 1, 2 );
  numeric i, j, xsiz, ysiz, gstep, angl, vlen, fact, xa, xb, yb;
  color vdir, bpos, ap, bp, cp, dp;
  path base;
  xsiz = 2;
  ysiz = 3;
  gstep = 0.23;
  angl = 33;
  vlen = 0.45;
  fact = 1.3;
  vdir = vlen*( 0, cosd(angl), sind(angl) );
  xa = 0.5*gstep;
  xb = (xsiz+0.5)*gstep;
  yb = (ysiz+0.5)*gstep;
  ap = (-xa,-xa,0);
  bp = (-xa,yb,0);
  cp = (xb,yb,0);
  dp = (xb,-xa,0);
  for i=0 upto xsiz:
    for j=0 upto ysiz:
      bpos := gstep*(i,j,0);
      draw rp(bpos-fact*vdir)--rp(bpos);
      drawarrow rp(bpos-fact*vdir)--rp(bpos-vdir);
    endfor;
  endfor;
  base = rp(ap)--rp(bp)--rp(cp)--rp(dp)--cycle;
  fill base withcolor 0.7background;
  draw base;
  for i=0 upto xsiz:
    for j=0 upto ysiz:
      bpos := gstep*(i,j,0);
      draw rp(bpos+fact*vdir)--rp(bpos);
      drawarrow rp(bpos)--rp(bpos+vdir);
    endfor;
  endfor;
  draw rp(black)--rp( (0,0,vlen) ) dashed evenly;
  angline( fact*vdir, (0,0,vlen), black, 0.7*vlen, btex 57$^\circ$ etex, urt );
  label.top( btex $\vec{B}$ etex, rp(vdir) );
endfig;

beginfig(2); 						
  f := ( 4, 3, 2 );
  numeric i, numplates, xdelta, iangle, ang, oray, iray, numpois;
  numeric aang, imray, omray, mmray, axray, numouts;
  color shade, shadea, shadeb, p[];
  path fucir, outerarrow, theknob;
  numplates = 11;
  numouts = 2;
  xdelta = 0.1;
  iangle = 53;
  oray = 0.5;
  iray = 0.07;
  imray = 0.52;
  omray = 0.67;
  mmray = 0.64;
  axray = 0.04;
  numpois = 10;
  shadea = 0.8background;
  shadeb = 0.6background;
  fucir = rigorouscircle( (-(numplates-1)*xdelta,0,0), red, imray );
  outerarrow = subpath (1.7,2.3) of fucir;
  p1 = ( -(numplates-1)*xdelta, imray, 0 );
  p2 = ( -(numplates-1)*xdelta, omray, 0 );
  p3 = ( -(numplates-2)*xdelta, imray, 0 );
  p4 = ( -(numplates-2)*xdelta, omray, 0 );
  p5 = ( -(numplates-4)*xdelta, mmray, 0 );
  p6 = ( -(numplates-2)*xdelta, mmray, 0 );
  p7 = ( -(numplates+1)*xdelta, mmray, 0 );
  p8 = ( -(numplates-1)*xdelta, mmray, 0 );
  p9 = ( -xdelta, cosd( 0.5*iangle )*0.5*oray, sind( 0.5*iangle )*0.5*oray );
  p0 = ( 0, cosd( 0.5*iangle )*0.5*oray, -sind( 0.5*iangle )*0.5*oray );
  for i=1-numplates upto 0:
    if odd(i):
      shade := shadea;
      ang := iangle;
    else:
      shade := shadeb;
      ang := 0;
    fi;
    platecap( i*xdelta, shade, ang, oray, iray, numpois );
    background := shadea;
    rigorousdisc( 0, true, (i*xdelta,0,0), axray, xdelta*red );
    background := shadeb;
    rigorousdisc( 0, true, (i*xdelta,-oray,0), axray, xdelta*red );
    background := background;
  endfor;
  for i=1 upto numouts:
    background := shadea;
    rigorousdisc( 0, true, (i*xdelta,0,0), axray, xdelta*red );
%    background := shadeb;
%    rigorousdisc( 0, true, (i*xdelta,-oray,0), axray, xdelta*red );
  endfor;
  theknob = rigorousfearpath( ((numouts+1)*xdelta,0,0), 2*axray );
  fill theknob;
  draw theknob;
  background := background;
  draw rp(p1)--rp(p2);
  draw rp(p3)--rp(p4);
  drawarrow rp(p5)--rp(p6);
  drawarrow rp(p7)--rp(p8);
  drawarrow outerarrow;
  label.ulft( btex $d$ etex, rp(p7) );
  label( btex $A$ etex, rp(p9) );  
  label( btex $A$ etex, rp(p0) );  
endfig;

beginfig(3); 						
  f := ( 3, 2, 1 );
  numeric oray, iray;
  path opath, ipath;
  color lRpos, Rpos, Ppos, zpos, rpos, spos;
  oray = 0.5;
  iray = 0.2oray;
  opath = rigorouscircle( black, blue, oray );
  ipath = rigorouscircle( black, blue, 0.2oray );
  fill opath withcolor 0.7background;
  fill ipath withcolor background;
  draw opath;
  draw ipath;
  lRpos = ( oray, 0, 0 );
  Rpos = 0.5lRpos;
  Ppos = ( 0, 0, 2oray );
  zpos = 0.5Ppos;
  rpos = ( 0, iray, 0 );
  spos = -Rpos;
  drawarrow rp(black)--rp(lRpos);
  drawarrow rp(black)--rp(Ppos);
  drawarrow rp(black)--rp(rpos);
  dotlabel.lft( btex $P$ etex, rp(Ppos) );
  label.rt( btex $z$ etex, rp(zpos) );
  label.ulft( btex $R$ etex, rp(Rpos) );
  label.lrt( btex $r$ etex, rp(rpos) );
  label( btex $\sigma$ etex, rp(spos) );
endfig;

beginfig(4); 						
  f := ( 3, 4, 2 );
  numeric raya, rayb, rayc, lena, lenb;
  color baseac, baseav, basebc, basebv, rayabbeg, rayabend, lambdapos;
  raya = 0.017;
  rayb = 0.1;
  rayc = 0.2;
  lena = 1.4;
  lenb = 0.6;
  baseac = 0.5*lena*red;
  baseav = -lena*red;
  basebc = 0.5*lenb*red;
  basebv = -lenb*red;
  rayabbeg = ( 0.5*lenb, raya, 0 );
  rayabend = ( 0.5*lenb, rayc, 0 );
  lambdapos = ( 0, rayc, 0 );
  rigorousdisc( 0, true, basebc, rayc, basebv );
  rigorousdisc( 0, true, baseac, raya, baseav );
  rigorousdisc( 0, false, basebc, rayc, basebv );
  drawarrow rp( rayabbeg )--rp( rayabend );
  label.bot( btex $R$ etex, rp( 0.5[rayabbeg,rayabend] ) );
  label( btex $\lambda_t$ etex, rp ( lambdapos ) );
  label.lrt( btex $\lambda_f$ etex, rp( 0.3[baseac,basebc] ) );
endfig;

beginfig(5); 						
  f := ( 5, 5, 3 );
  numeric i, numpoints, ray, aux, blen, bang, fa, fb, fc, fd;
  path wirea, wireb, wirec, wired, wirepath;
  color wa[], wb[], btip, xpos;
  pen bigpen, smallpen;
  numpoints = 36;
  ray = 0.5;
  blen = 0.8;
  fa = -1.1;
  fb = -0.8;
  fc = -fb;
  fd = -fa;
  bang = -45;
  btip = blen*(0,cosd( bang ), sind( bang ) );
  for i=1 upto numpoints:
    aux := i*180/numpoints;
    wa[i] = ray*(red*cosd(aux)+green*sind(aux));
%    drawarrow rp( wa[i] )--rp( wa[i]+btip );
    wb[i] = ray*(-red*cosd(aux)-blue*sind(aux));
%    drawarrow rp( wb[i] )--rp( wb[i]+btip );
  endfor;
  wirepath = for i=1 upto numpoints:
    rp( wa[i] )-- endfor for i=1 upto numpoints:
    rp( wb[i] )-- endfor cycle;
  bigpen = pencircle scaled 3pt;
  smallpen = pencircle scaled 2.2pt;
  draw wirepath withpen bigpen;
  wirea = rp( wb[numpoints] ) for i=1 upto numpoints:
    --rp( wa[i] ) endfor;
  wireb = rp( wa[numpoints] ) for i=1 upto numpoints:
    --rp( wb[i] ) endfor;
  wirec = rp( wb[numpoints-1] )--wirea--rp( wb[1] );
%  wired = rp( wa[numpoints-1] )--wireb--rp( wa[1] );
  draw wireb withpen smallpen withcolor background;
%  cartaxes( 2ray, 2ray, 1.2ray );
  draw rp( 2*ray*red )--rp( -2*ray*red ) dashed evenly;
  draw rp( black )--rp( -ray*blue );
  draw rp( black )--rp( ray*green );
  for i=-1 upto 1:
    xpos := (i*ray,0,0);
    drawarrow rp( xpos+fa*btip )--rp( xpos+fb*btip );
    drawarrow rp( xpos+fb*btip )--rp( xpos+fc*btip );
    draw rp( xpos+fc*btip )--rp( xpos+fd*btip );
  endfor;
  squareangline( -ray*blue, ray*green, black, 0.1*ray);
  draw wirea withpen bigpen;
  draw wirec withpen smallpen withcolor background;
  label.urt( btex $\vec{B}$ etex, rp( btip ) );
endfig;

beginfig(6);
  path baset, sphere;
  color va, vb, vc, qpos;
  va = (0,0,0);
  vb = (0.5,0.5*sqrt(3),0);
  vc = (-0.5,0.5*sqrt(3),0);
  baset = rp( va )--rp( vb )--rp( vc )--cycle;
  draw baset;
  qpos = (0,0.333*sqrt(3),0.333*sqrt(1-0.333*sqrt(3)) );
  sphere = rigorousfearpath( qpos, 0.1 );
  fill sphere withcolor background;
  draw sphere;
  label( btex +$q$ etex, rp( qpos ) );
endfig;

beginfig(7);
  Spread := 50;
  f := (4,6,3.5);
  path fiodecima, fioabaixo, malhacub, rama, ramb, ramc;
  path malhatet, ramd, rame;
  pen grossa, nuclear, negat;
  color p[];
  numeric altura, margem, largneg, largpos, afast, lengax, lscal;
  pair topo, base, decima, abaixo, centerfont, centerneg, centerpos;
  pair a, b, c, d, tx, ty, tz;
  altura = 2cm;
  margem = 3mm;
  largneg = 9mm;
  largpos = 18mm;
  afast = 5cm;
  lengax = 0.7;
  lscal = 2;
  grossa = pencircle scaled 2.7pt;
  nuclear = pencircle scaled 2.1pt;
  negat = pencircle scaled 1.8pt;
  p1 = (1,1,-1);
  p2 = (-1,1,-1);
  p3 = (-1,-1,-1);
  p4 = (1,-1,-1);
  p5 = (1,1,1);
  p6 = (-1,1,1);
  p7 = (-1,-1,1);
  p8 = (1,-1,1);
  p0 = (0,0,1);
  p9 = (0,0,-1);
  z1 = rp(p1);
  z2 = rp(p2);
  z3 = rp(p3);
  z4 = rp(p4);
  z5 = rp(p5);
  z6 = rp(p6);
  z7 = rp(p7);
  z8 = rp(p8);
  z0 = rp(p0);
  z9 = rp(p9);
  tx = rp( p1 - (lengax,0,0) ); 
  ty = rp( p1 - (0,lengax,0) ); 
  tz = rp( p1 + (0,0,lengax) ); 
  topo = (xpart z0, altura + ypart z0);
  base = (xpart z9, -altura + ypart z9);
  decima = (afast + xpart topo, ypart topo);
  abaixo = (afast + xpart base, ypart base);
  centerfont = 0.5*(decima+abaixo);
  centerpos = (xpart centerfont, 0.5*margem + ypart centerfont);
  centerneg = (xpart centerfont, -0.5*margem + ypart centerfont);
  fiodecima = z0--topo--decima--centerpos;
  fioabaixo = z9--base--abaixo--centerneg;
  a = ( -0.5*largpos + xpart centerfont, ypart centerpos);
  b = ( 0.5*largpos + xpart centerfont, ypart centerpos);
  c = ( -0.5*largneg + xpart centerfont, ypart centerneg);
  d = ( 0.5*largneg + xpart centerfont, ypart centerneg);
  malhacub = z1--z2--z3--z4--z1--z5--z6--z7--z8--z5;
  malhatet = z2--z7--z4--z5--cycle;
  rama = z2--z6;
  ramb = z3--z7;
  ramc = z4--z8;
  ramd = z5--z7;
  rame = z2--z4;
  drawoptions( dashed evenly );
  draw malhacub;
  draw rama;
  draw ramb;
  draw ramc;
  drawoptions( withpen grossa );
  draw malhatet;
  draw ramd;
  draw rame;
%  drawoptions( withpen nuclear withcolor background );
%  draw malhatet;
%  draw ramd;
%  draw rame;
  drawoptions();
  draw fiodecima;
  draw fioabaixo;
  draw a--b;
  drawarrow z1--tx withpen negat;
  drawarrow z1--ty withpen negat;
  drawarrow z1--tz withpen negat;
  label.lrt(btex $x$ etex scaled lscal, tx);
  label.llft(btex $y$ etex scaled lscal, ty);
  label.lft(btex $z$ etex scaled lscal, tz);
  linecap := butt;
  draw c--d withpen negat;
endfig;

beginfig(8);
  Spread := 50;
  f := (6,6,3.5);
  numeric squareside, sray, cdiameter, cray, distmargin, linemargin, eloing;
  squareside = 1;
  cdiameter = squareside/0.88623;
  cray = cdiameter/2.0;
  sray = squareside/2.0;
  distmargin = 0.5;
  linemargin = 0.15;
  eloing = 0.4;
  pen pena, penb, penc;
  pena = pencircle scaled 1.3mm;
  penb = pencircle scaled 0.95mm;
  penc = pencircle scaled 0.4mm;
  color tracecol, outcol, incol;
  tracecol = 0.5white;
  outcol = black;
  incol = 0.876white;
  color va, vb, vc, vd, cen, bs, bc, fs, fc, ds, dc;
  va = (0,-sray,-sray);
  vb = (0,sray,-sray);
  vc = (0,sray,sray);
  vd = (0,-sray,sray);
  cen = (-distmargin,0,0);
  bs = (0,-sray-linemargin,0);
  bc = bs+cen;
  fs = (0,sray+eloing,0);
  ds = (0,sray+eloing-linemargin,0);
  fc = fs+cen;
  dc = ds+cen;
  path rigcirc, carrpath, square, circ, sline, cline, dline;
  square = rp(va)--rp(vb)--rp(vc)--rp(vd)--cycle;
  circ = goodcirclepath( cen, red, cray );
  rigcirc = rigorouscircle( cen, red, cray+linemargin );
  carrpath = subpath (1,2) of rigcirc;
  sline = rp(bs)--rp(fs);
  cline = rp(bc)--rp(fc);
  dline = rp(ds)--rp(dc);
  
  draw cline withpen penc withcolor tracecol;
  draw circ withpen pena withcolor outcol;
  draw circ withpen penb withcolor incol;
  draw sline withpen penc withcolor tracecol;
  draw square withpen pena withcolor outcol;
  draw square withpen penb withcolor incol;
  drawdblarrow dline withpen penc withcolor tracecol;
  
  pair begsarr, endsarr;
  begsarr = rp((0,-sray-linemargin,linemargin));
  endsarr = rp((0,-sray-linemargin,sray));
  drawarrow begsarr--endsarr withpen penc withcolor tracecol;
  drawarrow carrpath withpen penc withcolor tracecol;

  label.lft( btex $I$ etex, rp((0,-sray-linemargin,sray-linemargin)) );
  label.top( btex $+$ etex, point 1.5 of rigcirc );
  label.top( btex $d$ etex, rp(dc) );
endfig;

beginfig(9);
  Spread := 50;
  f := (6,6,3.5);
  numeric squareside, sray, cdiameter, cray, distmargin, linemargin, eloing;
  squareside = 1;
  cdiameter = squareside/0.88623;
  cray = cdiameter/2.0;
  sray = squareside/2.0;
  distmargin = 0.5;
  linemargin = 0.15;
  eloing = 0.4;
  pen pena, penb, penc;
  pena = pencircle scaled 1.3mm;
  penb = pencircle scaled 0.95mm;
  penc = pencircle scaled 0.4mm;
  color tracecol, outcol, incol;
  tracecol = 0.5white;
  outcol = black;
  incol = 0.876white;
  color va, vb, vc, vd, cen, bs, bc, fs, fc, ds, dc, os, oc, ncc;
  va = (0,-sray,-sray);
  vb = (0,sray,-sray);
  vc = (0,sray,sray);
  vd = (0,-sray,sray);
  cen = (-distmargin,0,0);
  bs = (0,-sray-linemargin,0);
  bc = bs+cen;
  fs = (0,sray+eloing,0);
  ds = (0,sray+eloing-linemargin,0);
  fc = fs+cen;
  dc = ds+cen;
  os = (linemargin,sray,0);
  oc = (-distmargin-cdiameter-linemargin,sray,0);
  ncc = (-distmargin-cray,sray,0);
  path rigcirc, carrpath, square, circ, sline, cline, dline, oline;
  square = rp(va)--rp(vb)--rp(vc)--rp(vd)--cycle;
  circ = goodcirclepath( ncc, green, cray );
  rigcirc = rigorouscircle( ncc, green, cray+linemargin );
  carrpath = subpath (3,4) of rigcirc;
  sline = rp(bs)--rp(fs);
  cline = rp(bc)--rp(fc);
  dline = rp(ds)--rp(dc);
  oline = rp(os)--rp(oc);
  
  draw oline withpen penc withcolor tracecol;
  draw cline withpen penc withcolor tracecol;
  draw circ withpen pena withcolor outcol;
  draw circ withpen penb withcolor incol;
  draw sline withpen penc withcolor tracecol;
  draw square withpen pena withcolor outcol;
  draw square withpen penb withcolor incol;
  drawdblarrow dline withpen penc withcolor tracecol;
  
  pair begsarr, endsarr;
  begsarr = rp((0,-sray-linemargin,linemargin));
  endsarr = rp((0,-sray-linemargin,sray));
  drawarrow begsarr--endsarr withpen penc withcolor tracecol;
  drawarrow carrpath withpen penc withcolor tracecol;

  label.lft( btex $I$ etex, rp((0,-sray-linemargin,sray-linemargin)) );
  label.top( btex $+$ etex, point 3.5 of rigcirc );
  label.bot( btex $d$ etex, rp(dc) );
endfig;

verbatimtex
\end{document}
etex

end;