Debian Codegraph @

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

raw
1 % nemquira.mp
2 % L. Nobre G.
3 % 2002
4
5 input featpost3Dplus2D;
6
7
8
9 beginfig(1);
10 f := 7*(1,2,1);
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, angstep, counter;
17 color lenvec, currpos;
18
19 angstep := 20;
20 cylength := 0.45;
21 cyradius := 0.1;
22 basen := 4.5;
23 hn := 1;
24 basestep := cylength*1.37;
25 hstep := basestep;
26 basesdev := basestep*0.05;
27 hsdev := basesdev;
28 hbase := -0.8;
29 angsdev := 4;
30
31 basemax := basen*basestep;
32 hmax := hn*hstep;
33 counter := 0;
34 for i=-basen upto basen:
35 for j=-basen 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 := angsdev*normaldeviate;
44 atwo := j*angstep + angsdev*normaldeviate;
45 vcz := sind( atwo+90 );
46 vcy := cosd( atwo+90 )*sind( aone );
47 vcx := cosd( atwo+90 )*cosd( aone );
48 currpos := ( xcurr, ycurr, zcurr );
49 lenvec := cylength*( vcx, vcy, vcz );
50 % rigorousdisc( 0, true, currpos-0.5*lenvec, cyradius, lenvec);
51 counter := incr(counter);
52 generatedirline( counter, aone, 90+atwo, cylength, currpos );
53 endfor;
54 endfor;
55 endfor;
56 NL := counter;
57 director_invisible( true, 5, false );
58 endfig;
59
60 end;