summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/revolipsoid.mp
blob: 62390d9b939f271e3ad8fe36ac48660833c2c50b (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
% revolipsoid.mp
% L. Nobre G.
% 2011

input featpost3Dplus2D;

prologues := 1;

Spread := 20;
f := 7.1*(3,5,4);
ShadowOn := true;
HoriZon := -5;
LightSource := 10*(4,-2,4);

beginfig(1);
  setthestage(30,45);
  drawoptions( withpen pencircle scaled 1mm );
  numeric num, r, ste, i, j, aux;
  r = 1.6;
  num = 5;
  aux = 0.5*(num-1);
  ste = 90/aux;
  for i=-aux upto aux:
    for j=-aux upto aux:
      spheroid((red*j+green*i)*2*(r**aux),(cosd(i*ste),0,sind(i*ste)),r**(-j));
    endfor;
  endfor;
endfig;

ShadowOn := false;

beginfig(2);
  drawoptions( withpen pencircle scaled 1mm );
  numeric num, r, ste, i, j, aux, fac;
  color aim;
  r = 0.55;
  fac = 0.6;
  num = 6;
  aux = 0.5*(num-1);
  ste = 90/aux;
  for i=-aux upto aux:
    for j=-aux upto aux:
      aim := N(f-viewcentr)+fac*(i*red+j*green)/aux;
      spheroid((red*j+green*i)*3*r,aim,r);
    endfor;
  endfor;
endfig;

end.