prologues := 3;
outputtemplate := "%j/%j-%c.svg";
outputformat := "svg";
verbatimtex
%&latex
\documentclass{article}
\usepackage{amsmath}
\usepackage[charter]{mathdesign}
\begin{document}
etex
u:=4cm;
a:=2u;
h:=a/4;
s:=1.3;
path lemn;
path carre;
carre = (0,0)--(1,0)--(1,1)--(0,1)--cycle;
for i:=0 upto 359:
beginfig(i);
pickup pencircle scaled 0.6pt;
drawarrow (0,-s*u)--(0,s*u);
drawarrow (-s*u,0)--(s*u,0);
path cercle,hori,verti;
pair O,P,Q,R,M;
O:=(0,0);
cercle := fullcircle scaled (a);
pickup pencircle scaled 0.4pt;
draw cercle dashed evenly withcolor blue;
P:=(a/2*cosd(i),a/2*sind(i)); % chemin qui parcourt le cercle
Q:=(a/2*cosd(i),0); %projection sur (Ox)
% projection de Q sur [O,P]
R = cosd(i)*cosd(i)*(a/2*cosd(i),a/2*sind(i));
% M sur [PQ] tel que QM = QR
QR := abs(R-Q);
if(sind(i)>0.0):
M = Q + (0,QR);
else:
M = Q - (0,QR);
fi;
if i=0:
lemn:=M;
else:
lemn:= lemn--M;
fi;
if ((i>0) and (i<90)) or ((i>180) and (i<270)):
draw carre scaled 6 rotated (angle(Q-P)+180) shifted Q;
draw carre scaled 6 rotated (angle(R-P)) shifted R;
fi;
if((i>=90) and (i<180)) or ((i>=270) and (i<360)):
draw carre scaled 6 rotated (angle(Q-P)+180) shifted Q;
draw carre scaled 6 rotated (angle(R-P)+180) shifted R;
fi;
draw O--P dashed evenly withcolor blue;
draw P--Q dashed evenly withcolor blue;
draw R--Q--M withcolor green;
label.lrt(btex $a$ etex, (a/2,0));
label.llft(btex $x$ etex, (s*u,0));
label.llft(btex $y$ etex, (0,s*u));
label(btex \itshape Lemniscate \par de Gerono etex, (-0.7u,1.15u));
label(btex $x^4=a^2(x^2-y^2)$ etex, (0.7u,-1.15u));
dotlabel.llft(btex $O$ etex, O);
dotlabel.urt(btex $M$ etex, M);
dotlabel.urt(btex $P$ etex, P);
dotlabel.urt(btex $Q$ etex, Q);
dotlabel.urt(btex $R$ etex, R);
pickup pencircle scaled 1pt;
draw lemn withcolor red;
clip currentpicture to (-s*u,-s*u)--(s*u,-s*u)--(s*u,s*u)--(-s*u,s*u)--cycle;
endfig;
endfor;
end.