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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/* -*-ePiX-*- */
// fake 3D by layering
#include "epix.h"
using namespace ePiX;
// function to plot
P F(double u, double v)
{
return P(u, v, 0.25*(u+v)*(u-v));
}
P TF(double u, double v)
{
return P(u, v);
}
int main()
{
picture(P(-3,-2),P(3,2), "6x4in");
begin();
backing(Black());
label_color(White());
label(P(0, ymax()), P(0,-4),
"\\textbf{A quadratic saddle cut by a tangent plane}", b);
camera.at(P(6,12,8));
camera.look_at(P(0,0,-0.25));
domain R(P(-2,-2), P(2,2), mesh(24,24), mesh(48,48));
// clip to lower half space
clip_face(P(0,0,0), -E_3); // 2nd arg is inward normal vector
// draw shaded saddle
fill();
surface(F, R);
// and re-draw the wiremesh in color
bold();
green(); // change label color as well
plot(F, R);
label(F(0,2), P(0,-4), "$\\mathbf{z<0}$", b);
// (x,y)-plane
red();
plot(TF, R);
label(P(2,0,0), P(-4,-2), "$\\mathbf{z=0}$", bl);
clip_restore(); // remove old restriction
clip_face(P(0,0,0), E_3); // and set new one
fill(Blue()); // set pen and fill colors
surface(F, R);
// fake transparency: re-draw (x,y)-plane lightly
pen(Red(), 0.2);
plot(TF, R);
// and plot top half of wiremesh in color
bold(Blue());
plot(F, R);
rgb(0.5,0.5,1);
label(F(-2,0), P(4,4), "$\\mathbf{z>0}$", tr);
pst_format();
end();
}
|