Debian Codegraph @

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

raw
1 % revolipsoid.mp
2 % L. Nobre G.
3 % 2011
4
5 input featpost3Dplus2D;
6
7 prologues := 1;
8
9 Spread := 20;
10 f := 7.1*(3,5,4);
11 ShadowOn := true;
12 HoriZon := -5;
13 LightSource := 10*(4,-2,4);
14
15 beginfig(1);
16 setthestage(30,45);
17 drawoptions( withpen pencircle scaled 1mm );
18 numeric num, r, ste, i, j, aux;
19 r = 1.6;
20 num = 5;
21 aux = 0.5*(num-1);
22 ste = 90/aux;
23 for i=-aux upto aux:
24 for j=-aux upto aux:
25 spheroid((red*j+green*i)*2*(r**aux),(cosd(i*ste),0,sind(i*ste)),r**(-j));
26 endfor;
27 endfor;
28 endfig;
29
30 ShadowOn := false;
31
32 beginfig(2);
33 drawoptions( withpen pencircle scaled 1mm );
34 numeric num, r, ste, i, j, aux, fac;
35 color aim;
36 r = 0.55;
37 fac = 0.6;
38 num = 6;
39 aux = 0.5*(num-1);
40 ste = 90/aux;
41 for i=-aux upto aux:
42 for j=-aux upto aux:
43 aim := N(f-viewcentr)+fac*(i*red+j*green)/aux;
44 spheroid((red*j+green*i)*3*r,aim,r);
45 endfor;
46 endfor;
47 endfig;
48
49 end.
50