Debian Codegraph @

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

raw
1 % nembends.mp
2 % L. Nobre G.
3 % 2002
4
5 input featpost3Dplus2D;
6
7 %input mp-tool;
8
9 beginfig(1);
10 f := 2*(5,3,4);
11 Spread := 70;
12
13 numeric hsdev, basestep, basxstep, basesdev;
14 numeric i, j, k, coesdev, cylength, cyradius, basen;
15 numeric vcx, vcy, vcz, hcurr, xcurr, ycurr, aone;
16 numeric atwo, zcurr, coestep, angsdev, basxsdev;
17 color lenvec, currpos;
18
19
20 coestep := -0.15;
21 cylength := 0.6;
22 cyradius := 0.1;
23 basen := 3;
24 basestep := cylength*1.6;
25 basxstep := cyradius*4;
26 basesdev := basestep*0.001;
27 basxsdev := basxstep*0.001;
28 hsdev := 0.005;
29 coesdev := 0.001;
30 angsdev := 0.02;
31 for i=-basen upto basen:
32 for j=-basen upto basen:
33 xcurr := i*basxstep + basxsdev*normaldeviate;
34 ycurr := j*basestep + basesdev*normaldeviate;
35 zcurr := ycurr**2*coestep + coesdev*normaldeviate;
36 aone := angsdev*normaldeviate;
37 atwo :=angle(1,ycurr*2*coestep)+angsdev*normaldeviate;
38 vcz := cosd( aone )*sind( atwo );
39 vcy := cosd( aone )*cosd( atwo );
40 vcx := sind( aone );
41 currpos := ( xcurr, ycurr, zcurr );
42 lenvec := cylength*( vcx, vcy, vcz );
43 rigorousdisc(0,true,currpos-0.5*lenvec,cyradius,lenvec);
44 endfor;
45 endfor;
46 endfig;
47
48 end;