Cette partie donne des explications sur la représentation des orbites à partir des...
[pst-eqdf.git] / gravitation / animation_satellite.tex
1 \documentclass{article}
2 \usepackage[a4paper,margin=2cm]{geometry}
3 \usepackage[latin1]{inputenc}
4 \usepackage{pstricks,pst-eqdf}
5 \usepackage{animate}
6 \newpsstyle{vecteurA}{arrowinset=0.05,arrowsize=0.125,linecolor={[rgb]{1 0.5 0}}}
7 \newpsstyle{vecteurB}{arrowinset=0.05,arrowsize=0.1,linecolor={[rgb]{0 0.7 1}}}
8 \newpsstyle{vecteurC}{arrowinset=0.1,arrowsize=0.2,linecolor={[rgb]{1 0.5 0}}}
9 %%%%%%%%%%%%%%%%%%
10 \title{Animation du mouvement d'un satellite}
11 \date{23 juin 2\,012}
12 %timeline
13 \begin{filecontents}{satellite.dat}
14 ::0x0
15 ::1
16 ::2
17 ::3
18 ::4
19 ::5
20 ::6
21 ::7
22 ::8
23 ::9
24 ::10
25 ::11
26 ::12
27 ::13
28 ::14
29 ::15
30 ::16
31 ::17
32 ::18
33 ::19
34 ::20
35 ::21
36 ::22
37 ::23
38 ::24
39 ::25
40 ::26
41 ::27
42 ::28
43 ::29
44 ::30
45 ::31
46 ::32
47 ::33
48 ::34
49 ::35
50 ::36
51 ::37
52 ::38
53 ::39
54 ::40
55 ::41
56 ::42
57 ::43
58 ::44
59 ::45
60 ::46
61 ::47
62 ::48
63 ::49
64 ::50
65 ::51
66 ::52
67 \end{filecontents}
68 \newcommand{\Jupiter}{%
69 \psclip{\pscircle[fillstyle=solid,fillcolor=yellow]{1.5}}
70 \psset{fillstyle=solid,fillcolor={[cmyk]{0 0.2 0.4 0}},linestyle=none}
71 \psframe(-2,.6)(2,1)
72 \psframe(-2,0.45)(2,0.52)
73 \psframe(-2,.05)(2,.3)
74 \psframe(-2,-0.35)(2,-0.2)
75 \psframe(-2,-0.9)(2,-.5)
76 \endpsclip
77 \psellipse[fillstyle=solid,fillcolor={[cmyk]{0 0.4 0.6 0}},linestyle=none](-0.3,-0.6)(0.35,0.2)
78 \pscircle{1.5}}
79 \makeatletter
80 %% adapté de \psRandom du package pstricks-add
81 %% pour rendre aléatoire la taille des étoiles
82 %% Manuel Luque
83 \newdimen\pssizeStar
84 \def\psset@sizeStar#1{\pssetlength\pssizeStar{#1}}
85 \psset@sizeStar{1pt}
86 \define@key[psset]{pst-eqd}{randomPoints}[1000]{\def\psk@randomPoints{#1}}
87 \psset[pst-eqd]{randomPoints=1000}
88 \define@boolkey[psset]{pst-eqd}[Pst@]{color}[true]{}
89 \psset[pst-eqd]{color=false}
90 \def\psRandomStar{\pst@object{psRandomStar}}%
91 \def\psRandomStar@i{\@ifnextchar({\psRandomStar@ii}{\psRandomStar@iii(0,0)(1,1)}}
92 \def\psRandomStar@ii(#1){\@ifnextchar({\psRandomStar@iii(#1)}{\psRandomStar@iii(0,0)(#1)}}
93 \def\psRandomStar@iii(#1)(#2)#3{%
94 \def\pst@tempA{#3}%
95 \ifx\pst@tempA\pst@empty\psclip{\psframe(#2)}\else\psclip{#3}\fi
96 \pst@getcoor{#1}\pst@tempA
97 \pst@getcoor{#2}\pst@tempB
98 \begin@SpecialObj
99 \addto@pscode{
100 \pst@tempA\space /yMin exch def
101 /xMin exch def
102 \pst@tempB\space /yMax exch def
103 /xMax exch def
104 /dy yMax yMin sub def
105 /dx xMax xMin sub def
106 rrand srand % initializes the random generator
107 /getRandReal { rand 2147483647 div } def
108 \psk@randomPoints {
109 /DS \pst@number\pssizeStar\space getRandReal mul def
110 \@nameuse{psds@\psk@dotstyle}
111 \ifPst@color getRandReal 1 1 sethsbcolor \fi
112 getRandReal dx mul xMin add
113 getRandReal dy mul yMin add
114 Dot
115 \ifx\psk@fillstyle\psfs@solid fill \fi stroke
116 } repeat
117 }%
118 \end@SpecialObj
119 \endpsclip
120 \ignorespaces
121 }
122 \makeatother
123 \begin{document}
124 \def\eqsatellite{%
125 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)}%
126 \begin{center}
127 %\begin{pspicture}(-10,-10)(6,6)
128 \def\nFrames{50}% 50 images
129 \begin{animateinline}[controls,loop,timeline=satellite.dat,%
130 begin={\begin{pspicture}(-10,-10)(6,6)},
131 end={\end{pspicture}}]{5}% 5 images/s
132 %\uput[r](0,3){$y$}\uput[u](3,0){$x$}
133 %\psset{unit=2}
134 \psframe*[linecolor={[cmyk]{1 1 0 0.7}}](-10,-10)(6,6)
135 \psRandomStar[linecolor={[rgb]{1,1,0.5}},
136 randomPoints=1000,sizeStar=1.25pt](-10,-10)(6,6){\psframe[linestyle=none](-10,-10)(6,6)}
137 \pstVerb{/tabXiYi [(XiYi.dat) run] def}%
138 \pstVerb{/GM 1 def
139 /theta0 30 def
140 /r0 2 def
141 /x0 r0 theta0 cos mul def
142 /y0 r0 theta0 sin mul def
143 /v0 0.85 def
144 /v0x v0 theta0 sin mul neg def
145 /v0y v0 theta0 cos mul def
146 /Lc r0 v0 mul def % moment cinetique
147 /par Lc dup mul GM div def % paramètre de l'ellipse
148 % excentricité
149 /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
150 %%%%%%%%%%%%%%
151 /a_2 par 1 exc dup mul sub div def % demi-grand axe
152 /b_2 par 1 exc dup mul sub sqrt div def % demi-petit axe
153 /periode 2 3.1416 dup mul a_2 3 exp mul GM div sqrt mul def}%
154 \psequadiff[method=rk4,
155 plotpoints=1000,
156 algebraic,
157 whichabs=0,
158 whichord=1,
159 tabname=XiYi,
160 % saveData,filename=XiYi.dat
161 ]{0}{43}{x0 y0 v0x v0y}{\eqsatellite}%
162 \listplot[linecolor=gray,unit=2]{XiYi aload pop}
163 \psequadiff[method=rk4,
164 plotpoints=1000,
165 algebraic,
166 whichabs=2,
167 whichord=3,
168 tabname=vxvy,
169 % saveData,filename=vxvy.dat
170 ]{0}{43}{x0 y0 v0x v0y}{\eqsatellite}%
171 %\listplot[unit=2,linecolor=red]{vxvy aload pop}
172 % on dessine la vitesse un point sur 50
173 %\pscircle[fillcolor=gray!70,fillstyle=solid,unit=2](0,0){0.4}
174 \Jupiter%
175 %\psgrid[subgriddiv=2,gridcolor=lightgray,gridlabels=8pt,unit=2](-5,-5)(3,3)
176 %\psline[arrowinset=0.05,arrowsize=0.1,unit=2]{<->}(3,0)(0,0)(0,3)
177 \newframe
178 \multiframe{\nFrames}{i=0+40}{
179 \psset{unit=2}%
180 \pstVerb{/tabXYpartiel {
181 2 2 \i\space {/I exch def
182 tabXiYi I get
183 tabXiYi I 1 add get
184 } for
185 } def
186 /vX vxvy \i\space get def
187 /vY vxvy \i\space 1 add get def
188 /xi tabXiYi \i\space get def
189 /yi tabXiYi \i\space 1 add get def
190 /ri3 xi dup mul yi dup mul add sqrt 3 exp def
191 /Fx xi ri3 div neg def
192 /Fy yi ri3 div neg def}%
193 \listplot[linecolor=red,linewidth=0.05]{tabXYpartiel}
194 \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)}}
195 \newframe
196 \listplot[linecolor=gray,unit=2]{XiYi aload pop}
197 \listplot[linecolor=red,unit=2,linewidth=0.05]{XiYi aload pop}
198 \psset{unit=2}%
199 \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)}
200 \end{animateinline}
201 \end{center}
202 \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.