-\documentclass{article}
-\usepackage[a4paper,margin=2cm]{geometry}
-\usepackage[latin1]{inputenc}
-\usepackage{pstricks,pst-eqdf}
-\usepackage{animate}
-\newpsstyle{vecteurA}{arrowinset=0.05,arrowsize=0.125,linecolor={[rgb]{1 0.5 0}}}
-\newpsstyle{vecteurB}{arrowinset=0.05,arrowsize=0.1,linecolor={[rgb]{0 0.7 1}}}
-\newpsstyle{vecteurC}{arrowinset=0.1,arrowsize=0.2,linecolor={[rgb]{1 0.5 0}}}
-%%%%%%%%%%%%%%%%%%
-\title{Animation du mouvement d'un satellite}
-\date{23 juin 2\,012}
-%timeline
-\begin{filecontents}{satellite.dat}
-::0x0
-::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
-\end{filecontents}
-\newcommand{\Jupiter}{%
- \psclip{\pscircle[fillstyle=solid,fillcolor=yellow]{1.5}}
- \psset{fillstyle=solid,fillcolor={[cmyk]{0 0.2 0.4 0}},linestyle=none}
- \psframe(-2,.6)(2,1)
- \psframe(-2,0.45)(2,0.52)
- \psframe(-2,.05)(2,.3)
- \psframe(-2,-0.35)(2,-0.2)
- \psframe(-2,-0.9)(2,-.5)
- \endpsclip
- \psellipse[fillstyle=solid,fillcolor={[cmyk]{0 0.4 0.6 0}},linestyle=none](-0.3,-0.6)(0.35,0.2)
- \pscircle{1.5}}
-\begin{document}
-\def\eqsatellite{%
-y[2]|y[3]|-GM*y[0]/((sqrt(y[0]^2+y[1]^2))^3)|-GM*y[1]/((sqrt(y[0]^2+y[1]^2))^3)}%
-\begin{center}
-%\begin{pspicture}(-10,-10)(6,6)
-\def\nFrames{50}% 50 images
-\begin{animateinline}[controls,loop,timeline=satellite.dat,%
- begin={\begin{pspicture}(-10,-10)(6,6)},
- end={\end{pspicture}}]{5}% 5 images/s
-%\uput[r](0,3){$y$}\uput[u](3,0){$x$}
-%\psset{unit=2}
-\psframe*[linecolor={[rgb]{0 0 0.5}}](-10,-10)(6,6)
-\pstVerb{/tabXiYi [(XiYi.dat) run] def}%
-\pstVerb{/GM 1 def
- /theta0 30 def
- /r0 2 def
- /x0 r0 theta0 cos mul def
- /y0 r0 theta0 sin mul def
- /v0 0.85 def
- /v0x v0 theta0 sin mul neg def
- /v0y v0 theta0 cos mul def
- /Lc r0 v0 mul def % moment cinetique
- /par Lc dup mul GM div def % paramètre de l'ellipse
-% excentricité
- /exc 1 0.5 v0 4 exp mul r0 dup mul mul GM r0 mul v0 dup mul mul sub GM dup mul div 2 mul add sqrt def
-%%%%%%%%%%%%%%
- /a_2 par 1 exc dup mul sub div def % demi-grand axe
- /b_2 par 1 exc dup mul sub sqrt div def % demi-petit axe
- /periode 2 3.1416 dup mul a_2 3 exp mul GM div sqrt mul def}%
-\psequadiff[method=rk4,
- plotpoints=1000,
- algebraic,
- whichabs=0,
- whichord=1,
- tabname=XiYi,
-% saveData,filename=XiYi.dat
-]{0}{43}{x0 y0 v0x v0y}{\eqsatellite}%
-\listplot[linecolor=gray,unit=2]{XiYi aload pop}
-\psequadiff[method=rk4,
- plotpoints=1000,
- algebraic,
- whichabs=2,
- whichord=3,
- tabname=vxvy,
-% saveData,filename=vxvy.dat
-]{0}{43}{x0 y0 v0x v0y}{\eqsatellite}%
-%\listplot[unit=2,linecolor=red]{vxvy aload pop}
-% on dessine la vitesse un point sur 50
-%\pscircle[fillcolor=gray!70,fillstyle=solid,unit=2](0,0){0.4}
-\Jupiter%
-%\psgrid[subgriddiv=2,gridcolor=lightgray,gridlabels=8pt,unit=2](-5,-5)(3,3)
-%\psline[arrowinset=0.05,arrowsize=0.1,unit=2]{<->}(3,0)(0,0)(0,3)
-\newframe
-\multiframe{\nFrames}{i=0+40}{
-\psset{unit=2}%
-\pstVerb{/tabXYpartiel {
- 2 2 \i\space {/I exch def
- tabXiYi I get
- tabXiYi I 1 add get
- } for
- } def
- /vX vxvy \i\space get def
- /vY vxvy \i\space 1 add get def
- /xi tabXiYi \i\space get def
- /yi tabXiYi \i\space 1 add get def
- /ri3 xi dup mul yi dup mul add sqrt 3 exp def
- /Fx xi ri3 div neg def
- /Fy yi ri3 div neg def}%
-\listplot[linecolor=red,linewidth=0.05]{tabXYpartiel}
-\rput(!xi yi){\pscircle[fillstyle=solid,fillcolor=gray!50]{0.075}\psline[style=vecteurA]{->}(! vX 2 mul vY 2 mul)\psline[style=vecteurB]{->}(! Fx 5 mul Fy 5 mul)}}
-\newframe
-\listplot[linecolor=gray,unit=2]{XiYi aload pop}
-\listplot[linecolor=red,unit=2,linewidth=0.05]{XiYi aload pop}
-\psset{unit=2}%
-\rput(!x0 y0){\pscircle[fillstyle=solid,fillcolor=gray!50]{0.075}\psline[style=vecteurA]{->}(! v0x 2 mul v0y 2 mul)\psline[style=vecteurB]{->}(! x0 r0 3 exp div 5 mul neg y0 r0 3 exp div 5 mul neg)}
-\end{animateinline}
-\end{center}
-\end{document}
+\documentclass{article}\r
+\usepackage[a4paper,margin=2cm]{geometry}\r
+\usepackage[latin1]{inputenc}\r
+\usepackage{pstricks,pst-eqdf}\r
+\usepackage{animate}\r
+\newpsstyle{vecteurA}{arrowinset=0.05,arrowsize=0.125,linecolor={[rgb]{1 0.5 0}}}\r
+\newpsstyle{vecteurB}{arrowinset=0.05,arrowsize=0.1,linecolor={[rgb]{0 0.7 1}}}\r
+\newpsstyle{vecteurC}{arrowinset=0.1,arrowsize=0.2,linecolor={[rgb]{1 0.5 0}}}\r
+%%%%%%%%%%%%%%%%%%\r
+\title{Animation du mouvement d'un satellite}\r
+\date{23 juin 2\,012}\r
+%timeline\r
+\begin{filecontents}{satellite.dat}\r
+::0x0\r
+::1\r
+::2\r
+::3\r
+::4\r
+::5\r
+::6\r
+::7\r
+::8\r
+::9\r
+::10\r
+::11\r
+::12\r
+::13\r
+::14\r
+::15\r
+::16\r
+::17\r
+::18\r
+::19\r
+::20\r
+::21\r
+::22\r
+::23\r
+::24\r
+::25\r
+::26\r
+::27\r
+::28\r
+::29\r
+::30\r
+::31\r
+::32\r
+::33\r
+::34\r
+::35\r
+::36\r
+::37\r
+::38\r
+::39\r
+::40\r
+::41\r
+::42\r
+::43\r
+::44\r
+::45\r
+::46\r
+::47\r
+::48\r
+::49\r
+::50\r
+::51\r
+::52\r
+\end{filecontents}\r
+\newcommand{\Jupiter}{%\r
+ \psclip{\pscircle[fillstyle=solid,fillcolor=yellow]{1.5}}\r
+ \psset{fillstyle=solid,fillcolor={[cmyk]{0 0.2 0.4 0}},linestyle=none}\r
+ \psframe(-2,.6)(2,1)\r
+ \psframe(-2,0.45)(2,0.52)\r
+ \psframe(-2,.05)(2,.3)\r
+ \psframe(-2,-0.35)(2,-0.2)\r
+ \psframe(-2,-0.9)(2,-.5)\r
+ \endpsclip\r
+ \psellipse[fillstyle=solid,fillcolor={[cmyk]{0 0.4 0.6 0}},linestyle=none](-0.3,-0.6)(0.35,0.2)\r
+ \pscircle{1.5}}\r
+\makeatletter\r
+%% adapté de \psRandom du package pstricks-add\r
+%% pour rendre aléatoire la taille des étoiles\r
+%% Manuel Luque\r
+\newdimen\pssizeStar\r
+\def\psset@sizeStar#1{\pssetlength\pssizeStar{#1}}\r
+\psset@sizeStar{1pt}\r
+\define@key[psset]{pst-eqd}{randomPoints}[1000]{\def\psk@randomPoints{#1}}\r
+\psset[pst-eqd]{randomPoints=1000}\r
+\define@boolkey[psset]{pst-eqd}[Pst@]{color}[true]{}\r
+\psset[pst-eqd]{color=false}\r
+\def\psRandomStar{\pst@object{psRandomStar}}%\r
+\def\psRandomStar@i{\@ifnextchar({\psRandomStar@ii}{\psRandomStar@iii(0,0)(1,1)}}\r
+\def\psRandomStar@ii(#1){\@ifnextchar({\psRandomStar@iii(#1)}{\psRandomStar@iii(0,0)(#1)}}\r
+\def\psRandomStar@iii(#1)(#2)#3{%\r
+ \def\pst@tempA{#3}%\r
+ \ifx\pst@tempA\pst@empty\psclip{\psframe(#2)}\else\psclip{#3}\fi\r
+ \pst@getcoor{#1}\pst@tempA\r
+ \pst@getcoor{#2}\pst@tempB\r
+ \begin@SpecialObj\r
+ \addto@pscode{\r
+ \pst@tempA\space /yMin exch def\r
+ /xMin exch def\r
+ \pst@tempB\space /yMax exch def\r
+ /xMax exch def\r
+ /dy yMax yMin sub def\r
+ /dx xMax xMin sub def\r
+ rrand srand % initializes the random generator\r
+ /getRandReal { rand 2147483647 div } def\r
+ \psk@randomPoints {\r
+ /DS \pst@number\pssizeStar\space getRandReal mul def\r
+ \@nameuse{psds@\psk@dotstyle}\r
+ \ifPst@color getRandReal 1 1 sethsbcolor \fi\r
+ getRandReal dx mul xMin add\r
+ getRandReal dy mul yMin add\r
+ Dot\r
+ \ifx\psk@fillstyle\psfs@solid fill \fi stroke\r
+ } repeat\r
+ }%\r
+ \end@SpecialObj\r
+ \endpsclip\r
+ \ignorespaces\r
+}\r
+\makeatother\r
+\begin{document}\r
+\def\eqsatellite{%\r
+y[2]|y[3]|-GM*y[0]/((sqrt(y[0]^2+y[1]^2))^3)|-GM*y[1]/((sqrt(y[0]^2+y[1]^2))^3)}%\r
+\begin{center}\r
+%\begin{pspicture}(-10,-10)(6,6)\r
+\def\nFrames{50}% 50 images\r
+\begin{animateinline}[controls,loop,timeline=satellite.dat,%\r
+ begin={\begin{pspicture}(-10,-10)(6,6)},\r
+ end={\end{pspicture}}]{5}% 5 images/s\r
+%\uput[r](0,3){$y$}\uput[u](3,0){$x$}\r
+%\psset{unit=2}\r
+\psframe*[linecolor={[cmyk]{1 1 0 0.7}}](-10,-10)(6,6)\r
+\psRandomStar[linecolor={[rgb]{1,1,0.5}},\r
+ randomPoints=1000,sizeStar=1.25pt](-10,-10)(6,6){\psframe[linestyle=none](-10,-10)(6,6)}\r
+\pstVerb{/tabXiYi [(XiYi.dat) run] def}%\r
+\pstVerb{/GM 1 def\r
+ /theta0 30 def\r
+ /r0 2 def\r
+ /x0 r0 theta0 cos mul def\r
+ /y0 r0 theta0 sin mul def\r
+ /v0 0.85 def\r
+ /v0x v0 theta0 sin mul neg def\r
+ /v0y v0 theta0 cos mul def\r
+ /Lc r0 v0 mul def % moment cinetique\r
+ /par Lc dup mul GM div def % paramètre de l'ellipse\r
+% excentricité\r
+ /exc 1 0.5 v0 4 exp mul r0 dup mul mul GM r0 mul v0 dup mul mul sub GM dup mul div 2 mul add sqrt def\r
+%%%%%%%%%%%%%%\r
+ /a_2 par 1 exc dup mul sub div def % demi-grand axe\r
+ /b_2 par 1 exc dup mul sub sqrt div def % demi-petit axe\r
+ /periode 2 3.1416 dup mul a_2 3 exp mul GM div sqrt mul def}%\r
+\psequadiff[method=rk4,\r
+ plotpoints=1000,\r
+ algebraic,\r
+ whichabs=0,\r
+ whichord=1,\r
+ tabname=XiYi,\r
+% saveData,filename=XiYi.dat\r
+]{0}{43}{x0 y0 v0x v0y}{\eqsatellite}%\r
+\listplot[linecolor=gray,unit=2]{XiYi aload pop}\r
+\psequadiff[method=rk4,\r
+ plotpoints=1000,\r
+ algebraic,\r
+ whichabs=2,\r
+ whichord=3,\r
+ tabname=vxvy,\r
+% saveData,filename=vxvy.dat\r
+]{0}{43}{x0 y0 v0x v0y}{\eqsatellite}%\r
+%\listplot[unit=2,linecolor=red]{vxvy aload pop}\r
+% on dessine la vitesse un point sur 50\r
+%\pscircle[fillcolor=gray!70,fillstyle=solid,unit=2](0,0){0.4}\r
+\Jupiter%\r
+%\psgrid[subgriddiv=2,gridcolor=lightgray,gridlabels=8pt,unit=2](-5,-5)(3,3)\r
+%\psline[arrowinset=0.05,arrowsize=0.1,unit=2]{<->}(3,0)(0,0)(0,3)\r
+\newframe\r
+\multiframe{\nFrames}{i=0+40}{\r
+\psset{unit=2}%\r
+\pstVerb{/tabXYpartiel {\r
+ 2 2 \i\space {/I exch def\r
+ tabXiYi I get\r
+ tabXiYi I 1 add get\r
+ } for\r
+ } def\r
+ /vX vxvy \i\space get def\r
+ /vY vxvy \i\space 1 add get def\r
+ /xi tabXiYi \i\space get def\r
+ /yi tabXiYi \i\space 1 add get def\r
+ /ri3 xi dup mul yi dup mul add sqrt 3 exp def\r
+ /Fx xi ri3 div neg def\r
+ /Fy yi ri3 div neg def}%\r
+\listplot[linecolor=red,linewidth=0.05]{tabXYpartiel}\r
+\rput(!xi yi){\pscircle[fillstyle=solid,fillcolor=gray!50]{0.075}\psline[style=vecteurA]{->}(! vX 2 mul vY 2 mul)\psline[style=vecteurB]{->}(! Fx 5 mul Fy 5 mul)}}\r
+\newframe\r
+\listplot[linecolor=gray,unit=2]{XiYi aload pop}\r
+\listplot[linecolor=red,unit=2,linewidth=0.05]{XiYi aload pop}\r
+\psset{unit=2}%\r
+\rput(!x0 y0){\pscircle[fillstyle=solid,fillcolor=gray!50]{0.075}\psline[style=vecteurA]{->}(! v0x 2 mul v0y 2 mul)\psline[style=vecteurB]{->}(! x0 r0 3 exp div 5 mul neg y0 r0 3 exp div 5 mul neg)}\r
+\end{animateinline}\r
+\end{center}\r
+\end{document}\r