Debian Codegraph @

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

raw
1 % nsmetica.mp
2 % L. Nobre G.
3 % 2002
4
5 input featpost3Dplus2D;
6
7
8
9 beginfig(1);
10 f := 2*(5,3,2);
11 Spread := 70;
12 NF := 0;
13
14 numeric hstep, hmax, hsdev, basestep, basemax, basesdev;
15 numeric i, j, k, angsdev, cylength, cyradius, basen, hn;
16 numeric vcx, vcy, vcz, hcurr, xcurr, ycurr, hbase, aone;
17 numeric atwo, zcurr, counter;
18 color lenvec, currpos;
19
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Sma
21 cylength := 0.45;
22 cyradius := 0.1;
23 basen := 11;
24 hn := 3;
25 basestep := cyradius*2.4;
26 hstep := cylength*2.1;
27 basesdev := cyradius*0.3;
28 hsdev := hstep*0.04;
29 hbase := -0.8;
30 angsdev := 7;
31
32 basemax := basen*basestep;
33 hmax := hn*hstep;
34 hcurr := hbase;
35 counter := 0;
36 for k=1 upto hn:
37 hcurr := hcurr + hstep;
38 for i=1 upto basen:
39 for j=1 upto basen:
40 zcurr := hcurr + hsdev*normaldeviate;
41 xcurr := (i-1)*basestep + uniformdeviate( basestep );
42 ycurr := (j-1)*basestep + uniformdeviate( basestep );
43 aone := uniformdeviate( 360 );
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 lenvec := cylength*( vcx, vcy, vcz );
50 counter := incr( counter );
51 generatedirline( counter, aone, 90-atwo, cylength, currpos );
52 % rigorousdisc( 0, true, currpos-0.5*lenvec, cyradius, lenvec);
53 endfor;
54 endfor;
55 endfor;
56 NL := counter;
57 director_invisible( true, 5, false );
58 endfig;
59
60 end;