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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
% Maxime Chupin, Alexander Grahn
% 2022/01/21
prologues:=3;
outputtemplate := "%j_%c.mps";
outputformat := "mps";
verbatimtex
\documentclass{article}
%\usepackage{lmodern}
\usepackage[tt=false]{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{amsmath}
\begin{document}
etex
u:=4cm;
vardef proj(expr P,M,N)=
save H;
pair H;
H=whatever [M,N];
H-P=whatever * (M - N) rotated 90;
H
enddef;
path dr,cercle,drb,scara;
pair A,B,C,D,Q,T,O',P,O,M;
O:=(0,0);
O':=(-u/3,0);
A:=(u/sqrt(2),u/sqrt(2)) shifted O';
B:=(u/sqrt(2),-u/sqrt(2)) shifted O';
C:=(-u/sqrt(2),-u/sqrt(2))shifted O';
D:=(-u/sqrt(2),u/sqrt(2)) shifted O';
dr:=A--C;
drb:=B--D;
%scarabaeus construction
for i:=0 upto 100:
if i=0:
P:=A;
Q:=O';
M:=proj(O,P,Q);
scara:=M;
else:
scara:=M;
for j:=1 upto 4:
k:=4*(i-1)+j;
if (k<200) or (k=200):
P:=point (k*0.005) of dr;
cercle:=halfcircle
scaled 2u rotated 45 shifted P;
if k=0:
Q:=O';
fi;
if (k<>0) and (k<>200):
Q:=cercle intersectionpoint drb;
fi;
if k=200:
Q:=O';
fi;
else:
P:= point (2-k*0.005) of dr;
cercle:=halfcircle
scaled 2u rotated (-135) shifted P;
if k<400:
Q:=cercle intersectionpoint drb;
fi;
if k=400:
Q:=O';
fi;
fi;
M:=proj(O,P,Q);
scara:=scara--M;
endfor;
fi;
beginfig(i) %red scarabaeus segments
pickup pencircle scaled 1pt;
draw scara withcolor red;
setbounds currentpicture to
(u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;
beginfig(i+101) %moving construction lines and labels
draw 12[P,Q]--12[Q,P] dashed evenly;
draw O--M dashed evenly;
pickup pencircle scaled 1.4pt;
draw P--Q withcolor blue;
label.rt(btex $2l$ etex, 0.5[P,Q]);
dotlabel.urt(btex $P$ etex, P);
dotlabel.llft(btex $Q$ etex,Q);
dotlabel.top(btex $M$ etex,M);
setbounds currentpicture to
(u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;
if (i/2.-floor(i/2.))=0: %gray lines every second image
beginfig(i/2+202)
draw P--Q withcolor 0.8 white;
setbounds currentpicture to
(u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;
fi;
endfor;
%coordinate axes and stationary stuff
beginfig(253);
path ida,mida;
drawarrow(-1.5u,0)--(1u,0);
drawarrow(0,-1.2u)--(0,1.2u);
ida:=12[A,C]--12[C,A];
mida:=(12[D,B]--12[B,D]);
draw ida dashed evenly;
draw mida dashed evenly;
label.top(btex $a$ etex, 0.5[O,O']);
label.top(btex $x$ etex, (0.8u,0));
label.rt(btex $y$ etex, (0,u));
label.bot(btex\itshape{\underline{scarabaeus}} etex,(-1.1u,1.1u));
label.bot(btex $r=l\cos 2t-a\cos t$ etex, (-u/2,1.1u));
dotlabel.urt(btex $O'$ etex, O');
dotlabel.urt(btex $O$ etex, O);
dotlabel.rt(btex $A$ etex,A);
dotlabel.rt(btex $B$ etex,B);
dotlabel.lft(btex $C$ etex,C);
dotlabel.lft(btex $D$ etex,D);
setbounds currentpicture to
(u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;
end.
|