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
71
72
73
74
|
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;
P f(double x, double t)
{
return P(x, Sin(x+t));
}
domain R(P(0,0), P(1,1), mesh(60,24), mesh(120, 72));
int main(int argc, char* argv[])
{
if (argc == 3)
{
char* arg;
double temp1, temp2;
temp1=strtod(argv[1], &arg);
temp2=strtod(argv[2], &arg);
tix()=temp1/temp2;
}
picture(P(0,0), P(5,2), "5x2in");
begin();
revolutions();
border();
set_crop();
screen rolling(P(-1,-1), P(1,1));
screen waving(P(0,-1), P(1,1));
activate(rolling);
P ctr(polar(0.5, tix()));
P rim(polar(0.5, tix()) + polar(0.5, -tix()));
P rim2(polar(0.5, tix()) + polar(0.5, 0.5-tix()));
circle(ctr, 0.5); // small wheel
bold();
circle(P(0,0), 1); // big wheel
green();
line(P(1,0), P(-1,0));
blue();
line(P(0,1), P(0,-1));
red();
line(ctr, rim);
line(ctr, rim2);
ddot(rim);
ddot(rim2);
deactivate(rolling);
activate(waving);
set_crop();
blue();
plot(f, R.slice2(tix()));
deactivate(waving);
inset(rolling, P(0,0), P(2,2));
inset(waving, P(3,0), P(5,2));
dashed();
pen(Blue(1.6), 0.15);
line(P(1,1+Sin(tix())), P(3,1) + f(0, tix()));
end();
}
|