summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/standard/twistflat.mp
blob: 080f3364282e821e6a12638082716ebea1cba079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
% twistflat.mp
% L. Nobre G. 
% Y2K

%input featpost3Dplus2D;

 

beginfig(1);

    f := 0.7*(1.5,0.3,1.2);

    Spread := 700;

    color gridvec, sizevec, currpos, starpos, bordpos;
    numeric i, j, k, counter, theta, phi, thetamin, 
            thetamax, thetastp, long, base;
    sizevec := (11,6,1);
    gridvec := (0.05,0.1,0.1);
    thetamin := 55;
    thetamax := 125;
    long := 0.08;
    base := 0.1;
    thetastp := (thetamax-thetamin)/(X(sizevec)-1);
    starpos := ( -0.5*X(gridvec)*(X(sizevec)-1) ,
                 -0.5*Y(gridvec)*(Y(sizevec)-1) ,
                 -0.5*Z(gridvec)*(Z(sizevec)-1) );
    bordpos := starpos - 0.5*gridvec;
    npf1 := 4;
    F1p1 := bordpos;
    F1p2 := (X(bordpos),-Y(bordpos), Z(bordpos));
    F1p3 := (-X(bordpos),-Y(bordpos), Z(bordpos));
    F1p4 := (-X(bordpos),Y(bordpos), Z(bordpos));
    NF := 1;
    draw facepath(1);
    counter := 1;
    for i=1 upto X(sizevec):
        for j=1 upto Y(sizevec):
            for k=1 upto Z(sizevec):
                phi := 90;
                theta := thetamin+(i-1)*thetastp;
                currpos := starpos+( (i-1)*X(gridvec) ,
                                     (j-1)*Y(gridvec) ,
                                     (k-1)*Z(gridvec) );
                generatedirline( counter, phi, theta, long, currpos );
                counter := incr(counter);
            endfor;
        endfor;
    endfor;
    NL := decr(counter);
    director_invisible( true, base, false );
endfig;

end;