Modification de web.xml
[luatex.git] / luamplibAnimate / mplibanimate.tex
1 \documentclass{article}
2 \usepackage{animate}
3 \usepackage{luamplib}
4
5 \begin{document}
6
7
8 \mplibcodeinherit{enable} % pour permettre la mémoire entre les
9 % biginfig(i) produites
10 \newcommand{\lemniscate}[1]{% #1: l'angle en degres
11 \begin{mplibcode}
12 if(#1=0):
13 u:=4cm;%
14 a:=2u;%
15 h:=a/4;%
16 s:=1.3;%
17 path lemn;%
18 path carre;%
19 carre = (0,0)--(1,0)--(1,1)--(0,1)--cycle;
20 fi;
21 beginfig(#1);
22 pickup pencircle scaled 0.6pt;
23 drawarrow (0,-s*u)--(0,s*u);
24 drawarrow (-s*u,0)--(s*u,0);
25 path cercle,hori,verti;
26 pair O,P,Q,R,M;
27 O:=(0,0);
28 cercle := fullcircle scaled (a);
29 pickup pencircle scaled 0.4pt;
30 draw cercle dashed evenly withcolor blue;
31 P:=(a/2*cosd(#1),a/2*sind(#1)); % chemin qui parcourt le cercle
32 Q:=(a/2*cosd(#1),0); %projection sur (Ox)
33 % projection de Q sur [O,P]
34 R = cosd(#1)*cosd(#1)*(a/2*cosd(#1),a/2*sind(#1));
35 % M sur [PQ] tel que QM = QR
36 QR := abs(R-Q);
37 if(sind(#1)>0.0):
38 M = Q + (0,QR);
39 else:
40 M = Q - (0,QR);
41 fi;
42
43 if #1=0:
44 lemn:=M;
45 else:
46 lemn:= lemn--M;
47 fi;
48
49 if ((#1>0) and (#1<90)) or ((#1>180) and (#1<270)):
50 draw carre scaled 6 rotated (angle(Q-P)+180) shifted Q;
51 draw carre scaled 6 rotated (angle(R-P)) shifted R;
52 fi;
53 if((#1>=90) and (#1<180)) or ((#1>=270) and (#1<360)):
54 draw carre scaled 6 rotated (angle(Q-P)+180) shifted Q;
55 draw carre scaled 6 rotated (angle(R-P)+180) shifted R;
56 fi;
57
58 draw O--P dashed evenly withcolor blue;
59 draw P--Q dashed evenly withcolor blue;
60 draw R--Q--M withcolor green;
61
62 label.lrt(btex $a$ etex, (a/2,0));
63 label.llft(btex $x$ etex, (s*u,0));
64 label.llft(btex $y$ etex, (0,s*u));
65 label(btex \itshape Lemniscate \par de Gerono etex, (-0.7u,1.15u));
66 label(btex $x^4=a^2(x^2-y^2)$ etex, (0.7u,-1.15u));
67
68
69 dotlabel.llft(btex $O$ etex, O);
70 dotlabel.urt(btex $M$ etex, M);
71 dotlabel.urt(btex $P$ etex, P);
72 dotlabel.urt(btex $Q$ etex, Q);
73 dotlabel.urt(btex $R$ etex, R);
74
75 pickup pencircle scaled 1pt;
76 draw lemn withcolor red;
77
78 clip currentpicture to (-s*u,-s*u)--(s*u,-s*u)--(s*u,s*u)--(-s*u,s*u)--cycle;
79 endfig;
80 \end{mplibcode}
81 }
82
83
84 \begin{center}
85 \begin{animateinline}[poster=last, controls]{24}
86 %
87 \multiframe{360}{i=0+1}{\lemniscate{\i}}
88 \end{animateinline}
89 \end{center}
90
91 Le PDF produit est à télécharger dans la liste plus haut.
92 \end{document}

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.