prologues := 3;
outputtemplate := "%j/%j-%c.svg";
outputformat := "svg";
verbatimtex
%&latex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[charter]{mathdesign}
\begin{document}
etex
u:=4cm;
picture trait[];
vardef proj(expr P,M,N) =
save H;
pair H;
H = whatever [M,N];
H - P = whatever * (M - N) rotated 90;
H
enddef;
path scara,astro;
for i:=0 upto 400:
beginfig(i);
path ida,mida,dr,cercle,drb;
pair A,B,C,D,Q,T,O',P,O,M,N;
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';
ida := 12[A,C]--12[C,A];
mida := (12[D,B]--12[B,D]);
drawarrow (-1.5u,0)--(1u,0);
drawarrow (0,-1.2u)--(0,1.2u);
dr:=A--C;
drb:=B--D;
if (i<200) or (i=200):
P:= point (i*0.005) of dr;
cercle:=halfcircle scaled 2u rotated 45 shifted P;
if (i=0):
Q=O';
fi;
if (i<>0) and (i<>200):
Q:=cercle intersectionpoint drb;
fi;
if i=200:
Q=O';
fi;
fi;
if (i>200):
P:= point (2-i*0.005) of dr;
cercle:=halfcircle scaled 2u rotated (-135) shifted P;
if i<>400:
Q:=cercle intersectionpoint drb;
fi;
if i=400:
Q=O';
fi;
fi;
M=proj(O,P,Q);
draw 12[P,Q]--12[Q,P] dashed evenly;
if i=0:
scara:=M;
else:
scara:=scara--M;
fi;
%je définit ici la picture i faite d'un trait
trait[i]:=image(
draw P--Q withcolor 0.9 white;
);
%et je dessine toute succesivement jusqu'à i
for j:=0 step 8 until i:
draw trait[j];
endfor;
draw ida dashed evenly;
draw mida dashed evenly;
draw O--M dashed evenly;
pickup pencircle scaled 1pt;
draw scara withcolor red;
pickup pencircle scaled 1.4pt;
draw P--Q withcolor blue;
label.rt(btex $2l$ etex, 0.5[P,Q]);
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{Le scarabée} 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.urt(btex $P$ etex, P);
dotlabel.llft(btex $Q$ etex,Q);
dotlabel.top(btex $M$ etex,M);
dotlabel.rt(btex $A$ etex,A);
dotlabel.rt(btex $B$ etex,B);
dotlabel.lft(btex $C$ etex,C);
dotlabel.lft(btex $D$ etex,D);
clip currentpicture to (u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;
endfor;
end.