2 \documentclass{article
}
3 \usepackage[a4paper,margin=
2cm
]{geometry
}
4 \usepackage[T1]{fontenc}
5 \usepackage[latin1]{inputenc}%
6 \usepackage[garamond
]{mathdesign
}
7 \usepackage{pst-eqdf,pst-node
}
8 %\usepackage{array,amsmath}
13 \newpsstyle{vecteurA
}{arrowinset=
0.05,arrowsize=
0.1,linecolor=
{[rgb
]{1 0.5 0}}}
14 \newpsstyle{vecteurB
}{arrowinset=
0.05,arrowsize=
0.1,linecolor=
{[rgb
]{0 0.5 1}}}
15 \newpsstyle{vecteurC
}{arrowinset=
0.1,arrowsize=
0.2,linecolor=
{[rgb
]{1 0 0}}}
17 %% adapté de \psRandom du package pstricks-add
18 %% pour rendre aléatoire la taille des étoiles
21 \def\psset@sizeStar
#1{\pssetlength\pssizeStar{#1}}
23 \define@key
[psset
]{pst-eqd
}{randomPoints
}[1000]{\def\psk@randomPoints
{#1}}
24 \psset[pst-eqd
]{randomPoints=
1000}
25 \define@boolkey
[psset
]{pst-eqd
}[Pst@
]{color}[true
]{}
26 \psset[pst-eqd
]{color=false
}
27 \def\psRandomStar{\pst@object
{psRandomStar
}}%
28 \def\psRandomStar@i
{\@ifnextchar(
{\psRandomStar@ii
}{\psRandomStar@iii(
0,
0)(
1,
1)
}}
29 \def\psRandomStar@ii(
#1)
{\@ifnextchar(
{\psRandomStar@iii(
#1)
}{\psRandomStar@iii(
0,
0)(
#1)
}}
30 \def\psRandomStar@iii(
#1)(
#2)
#3{%
32 \ifx\pst@tempA
\pst@empty
\psclip{\psframe(
#2)
}\else\psclip{#3}\fi
33 \pst@getcoor
{#1}\pst@tempA
34 \pst@getcoor
{#2}\pst@tempB
37 \pst@tempA
\space /yMin exch def
39 \pst@tempB
\space /yMax exch def
43 rrand srand
% initializes the random generator
44 /getRandReal
{ rand
2147483647 div
} def
46 /DS
\pst@number
\pssizeStar\space getRandReal mul def
47 \@nameuse
{psds@
\psk@dotstyle
}
48 \ifPst@
color getRandReal
1 1 sethsbcolor
\fi
49 getRandReal dx mul xMin add
50 getRandReal dy mul yMin add
52 \ifx\psk@fillstyle
\psfs@solid fill
\fi stroke
62 \begin{filecontents
}{kepler16Nasa.dat
}
296 \title{Gravitation : une planète à deux soleils - animation
\textsc{Nasa
}}
297 \date{17 juillet
2\,
012}
299 %\section{L'animation à partir des données de la \textsc{Nasa}}
302 \def\nFrames{230}% 230 images (229 jours)
303 \begin{animateinline
}[controls,timeline=kepler16Nasa.dat,loop,
%
304 begin=
{\begin{pspicture
}(-
8,-
8)(
8,
8)
},
305 end=
{\end{pspicture
}}]{10}% 10 images/s
307 /Pi
3.14159265359 def
308 /
2Pi
6.28318530718 def
309 % les angles doivent être en degrés
310 % pour calculer les sinus, cosinus
312 /rad2deg
{ 180 mul Pi div
} bind def
% radians -> degrés
313 /deg2rad
{ 180 div Pi mul
} bind def
% degrés -> radians
314 /tan
{dup sin exch cos div
} def
321 /AV
{ % anomalie vraie
322 1 exc add
1 exc sub div sqrt AE rad2deg
2 div tan mul arctan
2 mul
324 /mA
0.6897 def
% masse étoile A
325 /mB
0.20255 def
% masse étoile B
326 /mt mA mB add def
% masse totale
327 /mP
3e-4 def
% masse planète
328 /a1
0.22431 def
% a pour le point réduit
329 /e1
0.15944 def
% excentricité
330 /p1 a1
1 e1 dup mul sub mul def
% paramètre
331 /pA p1 mB mul mt div def
% paramètre star A
332 /pB p1 mA mul mt div def
% paramètre star B
333 /e2
0.0069 def
% excentricité planète
334 /a2
0.7048 def
% demi-grand axe planète
335 /w1
263.464 def
% arguument
336 /w2
318 def
% arguument planète
337 /p2 a2
1 e2 dup mul sub mul def
% paramètre planète
339 % date periode excentricité -> Kepler -> anomalie excentrique
344 /AM ti
2Pi mul Ti div def
% anomalie moyenne à la date t
345 /AE AM def
% valeur initiale de anomalie excentrique
347 /AETemp
% anomalie excentrique provisoire
348 AM exc rad2deg AE sin mul add
354 % T=41.076 jours e=0.15944
356 % T=228.776 j e=0.0069
357 % on calcule sur la periode la planète
358 % on construit les tableaux des positions
359 % à 1 jour d'intervalle
363 /radius pA
1 e1 AV cos mul add div neg def
364 radius AV w1 add cos mul
365 radius AV w1 add sin mul
371 /radius pB
1 e1 AV cos mul add div def
372 radius AV w1 add cos mul
373 radius AV w1 add sin mul
379 /radius p2
1 e2 AV cos mul add div def
380 radius AV w2 add cos mul
381 radius AV w2 add sin mul
385 \psframe*
[linecolor=
{[cmyk
]{1 1 0 0.7}}](-
8,-
8)(
8,
8)
386 \psRandomStar[linecolor=
{[rgb
]{1,
1,
0.5}},
387 randomPoints=
1000,sizeStar=
1pt
](-
8,-
8)(
8,
8)
{\psframe[linestyle=none
](-
8,-
8)(
8,
8)
}
388 %\listplot[unit=10,linecolor=gray]{tabStarA aload pop}
389 %\listplot[unit=10,linecolor=gray]{tabStarB aload pop}
390 %\listplot[unit=10,linecolor=gray]{tabPlanet aload pop}
392 \multiframe{\nFrames}{i=
0+
2}{%
393 \pstVerb{/i1
\i\space def
394 /xA tabStarA i1 get
10 mul def
395 /yA tabStarA i1
1 add get
10 mul def
396 /xB tabStarB i1 get
10 mul def
397 /yB tabStarB i1
1 add get
10 mul def
398 /xP tabPlanet i1 get
10 mul def
399 /yP tabPlanet i1
1 add get
10 mul def
401 \pscircle[linestyle=none,fillstyle=gradient,gradmidpoint=
0,gradend=yellow,GradientCircle=true,gradbegin=yellow!
50!red!
50](!xA yA)
{0.6}
402 \pscircle[linestyle=none,fillstyle=gradient,gradmidpoint=
0,gradend=red,GradientCircle=true,gradbegin=red!
50](!xB yB)
{0.2}
403 \pscircle*
[linecolor=white
](!xP yP)
{0.1}