Debian Codegraph @

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

raw
1 % nemsaddl.mp and nemsplay.mp and nemtwist.mp and nembends.mp
2 % L. Nobre G.
3 % 2002
4
5 input featpost3Dplus2D;
6
7
8
9 beginfig(1);
10 f := 2*(5,3,4);
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;
17 color lenvec, currpos;
18
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% splay, sddle and twist
20 angstep := 10;
21 cylength := 0.6;
22 cyradius := 0.1;
23 basen := 3;
24 hn := 1;
25 basestep := cyradius*4.2;
26 hstep := cylength*1.4;
27 basesdev := cyradius*0.003;
28 hsdev := hstep*0.005;
29 hbase := -0.8;
30 angsdev := 3;
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% bend
32 % angstep := 15;
33 % cylength := 0.6;
34 % cyradius := 0.1;
35 % basen := 3;
36 % hn := 1;
37 % basestep := cylength*1.6;
38 % hstep := cyradius*3.4;
39 % basesdev := basestep*0.01;
40 % hsdev := hstep*0.005;
41 % hbase := -0.8;
42 % angsdev := 3;
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44
45 basemax := basen*basestep;
46 hmax := hn*hstep;
47 for i=-basen upto basen:
48 for j=-basen upto basen:
49 hcurr := hbase;
50 forever:
51 exitunless hcurr < hmax+hbase;
52 hcurr := hcurr + hstep;
53 zcurr := hcurr + hsdev*normaldeviate;
54 xcurr := i*basestep + basesdev*normaldeviate;
55 ycurr := j*basestep + basesdev*normaldeviate;
56 aone := angle((xcurr,ycurr))+angsdev*normaldeviate;
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 % atwo := ( i ++ j )*angstep + angsdev*normaldeviate;
59 % vcz := cosd( atwo );
60 % vcy := sind( atwo )*sind( aone ); % pure-splay
61 % vcx := sind( atwo )*cosd( aone ); % pure-splay
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 % atwo := ( i ++ j )*angstep + angsdev*normaldeviate;
64 % vcz := cosd( atwo );
65 % vcy := sind( atwo )*sind( aone ); % saddle-splay
66 % vcx := -sind( atwo )*cosd( aone ); % saddle-splay
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 atwo := ( i ++ j )*angstep + angsdev*normaldeviate;
69 vcz := cosd( atwo );
70 vcy := sind( atwo )*sind( aone+90 );% pure-twist
71 vcx := sind( atwo )*cosd( aone+90 );% pure-twist
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 % atwo := j *angstep + angsdev*normaldeviate;
74 % vcz := sind( atwo );
75 % vcy := cosd( atwo ); % pure-bend
76 % vcx := 0; % pure-bend
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 currpos := ( xcurr, ycurr, zcurr );
79 lenvec := cylength*( vcx, vcy, vcz );
80 rigorousdisc( 0, true, currpos-0.5*lenvec, cyradius, lenvec);
81 endfor;
82 endfor;
83 endfor;
84 endfig;
85
86 end;