Debian Codegraph @

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

raw
1 % nembiaxi.mp
2 % L. Nobre G.
3 % 2002
4
5 input featpost3Dplus2D;
6
7
8
9 beginfig(1);
10 f := 1.3*(4,5,3);
11 Spread := 70;
12
13 numeric hstep, hmax, hsdev, basestep, basemax, basesdev;
14 numeric i, j, k, angsdev, cylength, cyradius, basen, hn;
15 numeric vcx, vcy, vcz, hcurr, xcurr, ycurr, hbase, aone;
16 numeric atwo, zcurr, counter;
17 color lenvec, currpos, xnoise, tmpcol;
18
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Nb
20 cylength := 0.45;
21 cyradius := 0.1;
22 basen := 5;
23 hn := 3;
24 basestep := cylength*1.65;
25 hstep := cylength;
26 basesdev := basestep*0.1;
27 hsdev := hstep*0.1;
28 hbase := -0.8;
29 angsdev := 12;
30
31 basemax := basen*basestep;
32 hmax := hn*hstep;
33 counter := 0;
34 for i=1 upto basen:
35 for j=1 upto basen:
36 hcurr := hbase;
37 forever:
38 exitunless hcurr < hmax+hbase;
39 hcurr := hcurr + hstep;
40 zcurr := hcurr + hsdev*normaldeviate;
41 xcurr := i*basestep + basesdev*normaldeviate;
42 ycurr := j*basestep + basesdev*normaldeviate;
43 aone := uniformdeviate( 10 )-5;
44 atwo := angsdev*normaldeviate;
45 vcz := cosd( atwo );
46 vcy := sind( atwo )*sind( aone );
47 vcx := sind( atwo )*cosd( aone );
48 currpos := ( xcurr, ycurr, zcurr );
49 xnoise := ( sind( angsdev*normaldeviate ), 0, 0 );
50 xnoise := green + xnoise;
51 tmpcol := ncrossprod( ( vcx, vcy, vcz ), xnoise );
52 lenvec := cylength*tmpcol;
53 % rigorousdisc( 0, true, currpos-0.5*lenvec, cyradius, lenvec);
54 counter := incr( counter );
55 generateonebiax( counter, aone, atwo, cylength,
56 90, 0.35*cylength, currpos );
57 endfor;
58 endfor;
59 endfor;
60 NL := counter;
61 director_invisible( false, 7, true );
62 endfig;
63
64 end;