Debian Codegraph @

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

raw
1 % lcurvature.mp
2 % L. Nobre G.
3 % 2002
4
5 input featpost3Dplus2D;
6
7 verbatimtex
8 \documentclass{article}
9 \usepackage{beton}
10 \usepackage{concmath}
11 \usepackage{ccfonts}
12 \begin{document}
13 etex
14
15 beginfig(1);
16 f := (5,3,4);
17 Spread := 70;
18 numeric gridstep, anglstep, cylength, cyradius, numcylis;
19 numeric i, j, curcoord, vcx, vcy, vcz, curangle, curnorma;
20 numeric major, othcoord, othangle;
21 color base, lenvec;
22 cylength := 0.1;
23 cyradius := 0.3;
24 gridstep := cyradius*2.2;
25 anglstep := 10;
26 numcylis := 5;
27 major := 0.35*gridstep*numcylis;
28 for i=1 upto numcylis: % bend
29 curnorma := i-0.5*(numcylis+1);
30 curangle := curnorma*anglstep;
31 vcx := cylength*cosd(curangle);
32 vcy := 0;
33 vcz := cylength*sind(curangle);
34 base := major*(sind(curangle),-1,-cosd(curangle));
35 lenvec := (vcx,vcy,vcz);
36 rigorousdisc( 0, true,base,cyradius,lenvec);
37 endfor;
38 for i=1 upto numcylis: % twist
39 curnorma := i-0.5*(numcylis+1);
40 curcoord := curnorma*gridstep;
41 curangle := curnorma*anglstep;
42 vcx := 0;
43 vcy := cylength*sind(curangle);
44 vcz := cylength*cosd(curangle);
45 base := (curcoord,-vcy/2-major,-vcz/2+major);
46 lenvec := (vcx,vcy,vcz);
47 rigorousdisc( 0, true,base,cyradius,lenvec);
48 endfor;
49 for i=1 upto numcylis: % splay
50 curnorma := i-0.5*(numcylis+1);
51 curcoord := curnorma*gridstep;
52 curangle := curnorma*anglstep;
53 vcx := cylength*sind(curangle);
54 vcy := 0;
55 vcz := -cylength*cosd(curangle);
56 lenvec := (vcx,vcy,vcz);
57 for j=1 upto numcylis:
58 othcoord := (j-0.5*(numcylis+1))*gridstep;
59 base := major*(0,1,-cosd(curangle));
60 base := base +(curcoord,othcoord,0);
61 rigorousdisc( 0, true,base,cyradius,lenvec);
62 endfor;
63 endfor;
64 for i=1 upto numcylis: % saddle
65 curnorma := i-0.5*(numcylis+1);
66 curcoord := curnorma*gridstep;
67 curangle := curnorma*anglstep;
68 vcx := cylength*sind(curangle);
69 for j=1 upto numcylis:
70 othcoord := (j-0.5*(numcylis+1))*gridstep;
71 othangle := (j-0.5*(numcylis+1))*anglstep;
72 vcy := -cylength*sind(othangle);
73 vcz := -cylength*cosd(curangle)*cosd(othangle);
74 base := major*(0,1,1-cosd(curangle)+cosd(othangle));
75 base := base + (curcoord,othcoord,0);
76 lenvec := (vcx,vcy,vcz);
77 rigorousdisc( 0, true,base,cyradius,lenvec);
78 endfor;
79 endfor;
80 endfig;
81
82 beginfig(2);
83 f := (5,3,4);
84 Spread := 70;
85 numeric gridstep, cylength, cyradius, numcylis;
86 numeric i, j, curcoord, curangle, curnorma;
87 numeric othcoord, othangle, zcoord, coef, othnorma;
88 color base, lenvec;
89 cylength := 0.1;
90 cyradius := 0.3;
91 gridstep := cyradius*2.2;
92 numcylis := 5;
93 coef := 0.32;
94 for i=1 upto numcylis: % splay
95 curnorma := i-0.5*(numcylis+1);
96 curcoord := curnorma*gridstep;
97 curangle := -curcoord*2*coef;
98 for j=1 upto numcylis:
99 othnorma := j-0.5*(numcylis+1);
100 othcoord := othnorma*gridstep;
101 othangle := -othcoord*2*coef;
102 zcoord := -coef*(othcoord**2+curcoord**2);
103 base := (curcoord,othcoord,zcoord);
104 lenvec := cylength*N((-curangle,-othangle,1));
105 rigorousdisc( 0, true,base,cyradius,lenvec);
106 endfor;
107 endfor;
108 endfig;
109
110 verbatimtex
111 \end{document}
112 etex
113
114 end;