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
|
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;
// surface to plot (a dog saddle)
P f(double u, double v)
{
return P(u, v, 0.5*u*v*(u-v)*(u+v));
}
// position-dependent color function
P color(double x, double y, double z)
{
#ifdef LAUREL_BURCH
return P(-Sin(0.25*x), 0.2, -Cos(0.25*x)); // Laurel Burch colors
#else
return P(-tanh(z), 0, tanh(z)); // Quasi-geographic 70s colors
#endif
}
int main()
{
picture(P(-3,-3), P(3,3), "6x6in");
begin();
// Set creation attributes,
revolutions();
set_crop();
fill();
// style attributes,
backing(Black());
plain(Yellow());
// and viewpoint.
camera.at(P(8, -8, 4));
// Add scenery
domain R(P(-2,-2), P(2, 2), mesh(36, 36), mesh(72, 72));
surface(f, R, color);
// and print
pst_format();
end();
}
|