Debian Codegraph @

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

raw
1 % twistflat.mp
2 % L. Nobre G.
3 % Y2K
4
5 input featpost3Dplus2D;
6
7
8
9 beginfig(1);
10
11 f := 0.7*(1.5,0.3,1.2);
12
13 Spread := 700;
14
15 color gridvec, sizevec, currpos, starpos, bordpos;
16 numeric i, j, k, counter, theta, phi, thetamin,
17 thetamax, thetastp, long, base;
18 sizevec := (11,6,1);
19 gridvec := (0.05,0.1,0.1);
20 thetamin := 55;
21 thetamax := 125;
22 long := 0.08;
23 base := 0.1;
24 thetastp := (thetamax-thetamin)/(X(sizevec)-1);
25 starpos := ( -0.5*X(gridvec)*(X(sizevec)-1) ,
26 -0.5*Y(gridvec)*(Y(sizevec)-1) ,
27 -0.5*Z(gridvec)*(Z(sizevec)-1) );
28 bordpos := starpos - 0.5*gridvec;
29 npf1 := 4;
30 F1p1 := bordpos;
31 F1p2 := (X(bordpos),-Y(bordpos), Z(bordpos));
32 F1p3 := (-X(bordpos),-Y(bordpos), Z(bordpos));
33 F1p4 := (-X(bordpos),Y(bordpos), Z(bordpos));
34 NF := 1;
35 draw facepath(1);
36 counter := 1;
37 for i=1 upto X(sizevec):
38 for j=1 upto Y(sizevec):
39 for k=1 upto Z(sizevec):
40 phi := 90;
41 theta := thetamin+(i-1)*thetastp;
42 currpos := starpos+( (i-1)*X(gridvec) ,
43 (j-1)*Y(gridvec) ,
44 (k-1)*Z(gridvec) );
45 generatedirline( counter, phi, theta, long, currpos );
46 counter := incr(counter);
47 endfor;
48 endfor;
49 endfor;
50 NL := decr(counter);
51 director_invisible( true, base, false );
52 endfig;
53
54 end;
55