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
|
/* -*-ePiX-*- */
/* tori.xp -- May 09, 2005 */
// compile tutorial torus meshes at once
#include "epix.h"
using namespace ePiX;
// torus
P F(double u, double v)
{
return polar(2.25+Cos(u), v) + P(0,0,Sin(u));
}
int main()
{
picture(P(0,0), P(4,1), "6 x 1.5in");
begin();
domain R(P(0,0), P(1,1), mesh(12,30), mesh(24, 60));
revolutions();
camera.at(10,7,5);
// unclipped/cropped
screen scr1(P(-3,-3), P(3,3));
activate(scr1);
fill(White());
surface(F, R);
inset(P(0,0), P(1,1));
deactivate(scr1);
// cropped
screen scr2(P(-3,-3), P(3,3));
activate(scr2);
set_crop();
border();
surface(F, R);
inset(P(1.5,0), P(2.5,1));
deactivate(scr2);
// clipped
screen scr3(P(-3,-3), P(3,3));
activate(scr3);
clip_box(P(3.5, 2, 1.5));
// box, sides layered manually
nofill();
rect(P(-3.5, -2, -1.5), P(-3.5, 2, 1.5));
rect(P(-3.5, -2, -1.5), P( 3.5, -2, 1.5));
fill();
surface(F, R);
nofill();
rect(P( 3.5, -2, -1.5), P( 3.5, 2, 1.5));
rect(P(-3.5, 2, -1.5), P( 3.5, 2, 1.5));
inset(P(3,0), P(4,1));
deactivate(scr3);
pst_format();
end();
}
|