summaryrefslogtreecommitdiff
path: root/graphics/pstricks/contrib/pst-solarsystem/tex/pst-solarsystem.tex
blob: daff8cb001e90532a2d47044222af8267dbc62e3 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
%% $Id: pst-solarsystem.tex 620 2012-01-01 14:09:57Z herbert $
%%
%% This is file `pst-solarsystem.tex',
%%
%% IMPORTANT NOTICE:
%%
%% Package `pst-solarsystem.tex'
%%
%% Manuel Luque <manuel -> perce.de>
%% Herbert Voss <herbert -> dante.de>
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% DESCRIPTION:
%%   `pst-solarsystem' is a PSTricks package for plotting the solar system
%%                     for a specific date
%%
\csname PSTSOLARSYSTEMELoaded\endcsname
\let\PSTSOLARSYSTEMELoaded\endinput
% Requires some packages
\ifx\PSTricksLoaded\endinput\else \input pstricks \fi
\ifx\PSTnodesLoaded\endinput\else \input pst-node \fi
\ifx\PSTplotLoaded\endinput\else  \input pst-plot \fi
\ifx\PSTthreeDLoaded\endinput\else\input pst-3d   \fi
\ifx\GradientLoaded\endinput\else \input pst-grad \fi
\ifx\PSTtoolsLoaded\endinput\else \input pst-tools\fi
\ifx\PSTXKeyLoaded\endinput\else  \input pst-xkey \fi
\def\fileversion{0.13}
\def\filedate{2017/08/22}
\message{`PSTSOLARSYSTEME' v\fileversion, \filedate}
%
\pstheader{pst-solarsystem.pro}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
%
\pst@addfams{pst-solarsystem}
\define@key[psset]{pst-solarsystem}{Day}[\number\day]{\def\psk@SolarSystemD{#1}}
\define@key[psset]{pst-solarsystem}{Month}[\number\month]{\def\psk@SolarSystemM{#1}}
\define@key[psset]{pst-solarsystem}{Year}[\number\year]{\def\psk@SolarSystemY{#1}}
\define@key[psset]{pst-solarsystem}{Hour}[12]{\def\psk@SolarSystemH{#1}}
\define@key[psset]{pst-solarsystem}{Minute}[0]{\def\psk@SolarSystemMi{#1}}
\define@key[psset]{pst-solarsystem}{Second}[0]{\def\psk@SolarSystemS{#1}}
%
\psset{Day=\number\day,Month=\number\month,Year=\number\year,Hour=12,Minute=0,Second=0}
%% === show the results ---------------------
%\newif\ifPst@solar@values
%\define@key[psset]{pst-solarsystem}{solarValues}{\@nameuse{Pst@solar@values#1}\ifPst@solar@values true \else false \fi}
\define@boolkey[psset]{pst-solarsystem}[Pst@]{solarValues}[true]{}
\psset[pst-solarsystem]{solarValues=true}




\newpsstyle{planetes}{linestyle=none,fillstyle=gradient,gradmidpoint=0,gradend=white,GradientCircle}
\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}}
%
\newcommand\Saturne{%
  \psellipse(3,0.7)
  \psellipse[linewidth=2\pslinewidth](3.5,1)
  \psellipse(4,1.2)
  \pscircle[fillstyle=solid](0,0){1.5}
  \psclip{\pscircle(0,0){1.5}}
    \psellipticarc(3,0.7){180}{0}
    \psellipticarc[linewidth=2\pslinewidth](3.5,1){180}{0}
    \psellipticarc(4,1.2){180}{0}
  \endpsclip
  \psellipticarc(0,0.5)(1.414,0.25){180}{0}
  \psellipticarc(0,1.25)(0.829,0.2){180}{0}
  \psellipticarc(0,-1)(1.118,0.2){180}{0}
  \psellipticarc(0,0)(1.5,0.27){180}{0}}
%
\psset{viewpoint=0 0 1}
%
\def\SolarSystem{\pst@object{SolarSystem}}
\def\SolarSystem@i{{%
  \pst@killglue
  \use@keep@par
  \begin{pspicture}(-8,-8)(8,8)
  \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0pt]%
  \pstVerb{%
   /JOUR \psk@SolarSystemD\space def
   /MOIS \psk@SolarSystemM\space def
   /AN \psk@SolarSystemY\space def
   /HEURE \psk@SolarSystemH\space def
   /MINUTE \psk@SolarSystemMi\space def
   /SECONDE \psk@SolarSystemS\space def
   %%%% Calcul du millénaire Julien ---------------------
   /lesMois [0 31 59 90 120 151 181 212 243 273 304 334] def
   /EcartJours {lesMois MOIS 1 sub get JOUR add HEURE MINUTE 60 div add SECONDE 3600 div add 24 div add 1 sub} def
   /EcartAn {AN 4 div AN 4 div floor sub cvi} bind def
   EcartAn 0 eq {/EcartAn 1 def} if
   EcartAn 1 eq {MOIS 2 gt {/EcartJours EcartJours 1 add def}if} if
   /T {AN 2000 sub 365.25 mul 0.5 add EcartJours add EcartAn sub 365250 div} bind def
   /T2 {T dup mul} bind def
   /T3 {T2 T mul} bind def
  }%
  \rput(0,8){\psk@SolarSystemD/\psk@SolarSystemM/\psk@SolarSystemY}%
  \ThreeDput{%
    % \psframe[fillstyle=gradient,gradbegin=cyan,gradend=white](-7,-7)(7,7)
    \multido{\r=22.5+45}{8}{\psline[linecolor=yellow](1;\r)}%
    \psline[linestyle=dotted]{->}(-7,0)(7,0)
    \uput[0](7,0){$\mathbf{\gamma}$}
    \uput[90](7,0){0\textsuperscript{o}}
    \uput[90](0,7){90\textsuperscript{o}}
    \uput[180](-7,0){180\textsuperscript{o}}
    \uput[270](0,-6.9){270\textsuperscript{o}}
    \psline[linestyle=dotted](0,-7)(0,7)}%
  \pscircle[linestyle=none,fillstyle=gradient,gradmidpoint=0,gradend=yellow,GradientCircle=true,gradbegin=gray]{0.5}%
  {\psset{unit=2}
     % Mercure
     \pstVerb{%
       merLM merKA merHA merQ merP orbitalparameters
       amer /radius exch 1 E dup mul sub mul
       1 E LO LP sub cos mul add div def }%
    \ThreeDput{%
      \psplot[polarplot,plotpoints=361,linecolor=red]{LN }{LN 180 add}{%
        amer 1 E dup mul sub mul 1 E x LP sub cos mul add div}%
      \psplot[polarplot,plotpoints=361,linestyle=dashed,linecolor=blue]{180 LN add}{LN 360 add}{%
        amer 1 E dup mul sub mul 1 E x LP sub cos mul add div}%
      \pnode(! radius LO cos mul radius LO sin mul){M}
    }%
  \rput(M){\psset{unit=2}%
    \pscircle[style=planetes,gradbegin=black,GradientPos={(0.01,0.01)}]{0.02}
    \uput[u](0,0){\footnotesize\textsf{Mercure}}}
  \ifPst@solarValues
    \rput(-2.5,-4.25){\psPrintValue{LO}}%
    \rput(-2.5,-4.75){\psPrintValue{LA}}%
    \rput(-2.5,-5.25){\psPrintValue{radius}}%
  \fi
% Venus
  \pstVerb{%
    venLM venKA venHA venQ venP orbitalparameters
    aven /radius exch 1 E dup mul sub mul
    1 E LO LP sub cos mul add div def }%
  \ThreeDput{%
    \psplot[polarplot,plotpoints=361,linecolor=red]{LN }{LN 180 add}{%
      aven 1 E dup mul sub mul   1 E x LP sub cos mul add div}
    \psplot[polarplot=true,plotpoints=361,linestyle=dashed,linecolor=blue]{180 LN add}{LN 360 add}{%
      aven 1 E dup mul sub mul
      1 E x LP sub cos mul add div}%
    \pnode(! radius LO cos mul radius LO sin mul){V}
  }%
  \rput(V){\psset{unit=2}%
    \pscircle[style=planetes,gradbegin={[HTML]{6F2D0A}},GradientPos={(0.03,0.03)}]{0.051}%
    \uput{0.07}[u](0,0){\footnotesize\textsf{V\'enus}}}
  \ifPst@solarValues
    \rput(-1.5,-4.25){\psPrintValue{LO}}%
    \rput(-1.5,-4.75){\psPrintValue{LA}}%
    \rput(-1.5,-5.25){\psPrintValue{radius}}%
  \fi
% Earth
  \pstVerb{%
    earLM earKA earHA earQ earP orbitalparameters
    aear /radius exch 1 E dup mul sub mul
    1 E LO LP sub cos mul add div def
  }%
  \ThreeDput{%
    \psplot[polarplot=true,plotpoints=361,linecolor=red]{0}{360}{%
      aear 1 E dup mul sub mul
      1 E x LP sub cos mul add div}
    \pnode(! radius LO cos mul radius LO sin mul){Terre}}
  \rput(Terre){\psset{unit=2}%
  \pscircle[style=planetes,gradbegin=blue,GradientPos={(0.013,0.03)}]{0.0536}%
  \uput{0.08}[u](0,0){\footnotesize\textsf{Terre}}}%
  \ifPst@solarValues
    \rput(-0.5,-4.25){\psPrintValue{LO}}%
    \rput(-0.5,-4.75){\psPrintValue{0.000}}%
    \rput(-0.5,-5.25){\psPrintValue{radius}}%
  \fi
% Mars
  \pstVerb{%
marLM marKA marHA marQ marP orbitalparameters
 amar /radius exch 1 E dup mul sub mul
 1 E LO LP sub cos mul add div def
  }%
  \ThreeDput{%
 \psplot[polarplot=true,plotpoints=361,linecolor=red]{LN }{LN 180 add}{%
 amar 1 E dup mul sub mul
 1 E x LP sub cos mul add div}%
 \psplot[polarplot=true,plotpoints=361,linestyle=dashed,linecolor=blue]{180 LN add}{LN 360 add}{%
 amar 1 E dup mul sub mul
 1 E x LP sub cos mul add div}%
\pnode(! radius LO cos mul radius LO sin mul){Mars}%
  }
  \rput(Mars){%
    \psset{unit=2}\pscircle[style=planetes,gradbegin=red,GradientPos={(0.01,0.01)}]{0.02857}
    \uput[u](0,0){\footnotesize\textsf{Mars}}}%
  \ifPst@solarValues
    \rput(0.5,-4.25){\psPrintValue{LO}}%
    \rput(0.5,-4.75){\psPrintValue{LA}}%
    \rput(0.5,-5.25){\psPrintValue{radius}}%
  \fi
% Jupiter
  \pstVerb{%
 jupLM jupKA jupHA jupQ jupP orbitalparameters
 /aJ ajup def
 aJ /radius exch 1 E dup mul sub mul
 1 E LO LP sub cos mul add div def
  }%
  \ThreeDput{%
 \psset{unit=0.5}
 \psplot[polarplot=true,plotpoints=361,linecolor=red]{LN }{LN 180 add}{%
 aJ 1 E dup mul sub mul
 1 E x LP sub cos mul add div}%
 \psplot[polarplot=true,plotpoints=361,linestyle=dashed,linecolor=blue]{180 LN add}{LN 360 add}{%
 aJ 1 E dup mul sub mul
 1 E x LP sub cos mul add div}%
\pnode(! radius LO cos mul radius LO sin mul){Jupiter}
  }%
  \rput(Jupiter){\psset{unit=0.1}\Jupiter%
    \uput{1.5}[u](0,0){\footnotesize\textsf{Jupiter}}}%
  \ifPst@solarValues
    \rput(1.5,-4.25){\psPrintValue{LO}}%
    \rput(1.5,-4.75){\psPrintValue{LA}}%
    \rput(1.5,-5.25){\psPrintValue{radius}}%
  \fi
% JSaturne
  \pstVerb{%
satLM satKA satHA satQ satP orbitalparameters
 /aS asat def
 aS /radius exch 1 E dup mul sub mul
     1 E LO LP sub cos mul add div def
  }%
  \ThreeDput{%
    \psset{unit=0.35}
 \psplot[polarplot=true,plotpoints=361,linecolor=red]{LN }{LN 180 add}{%
 aS 1 E dup mul sub mul
 1 E x LP sub cos mul add div}%
 \psplot[polarplot=true,plotpoints=361,linestyle=dashed,linecolor=blue]{180 LN add}{LN 360 add}{%
 aS 1 E dup mul sub mul
 1 E x LP sub cos mul add div}%
\pnode(! radius LO cos mul radius LO sin mul){Saturne}
  }%
  \rput(Saturne){\psset{unit=0.1}\Saturne%
    \uput{1.7}[u](0,0){\footnotesize\textsf{Saturne}}}%
  \ifPst@solarValues
    \rput(2.5,-4.25){\psPrintValue{LO}}%
    \rput(2.5,-4.75){\psPrintValue{LA}}%
    \rput(2.5,-5.25){\psPrintValue{radius}}%
  \fi
  }
  \use@par
  \ifPst@solarValues
    \rput(-4.5,-7.75){Mercure}%
    \rput(-2.5,-7.75){Venus}%
    \rput(-0.5,-7.75){Earth}%
    \rput(1.5,-7.75){Mars}%
    \rput(3.5,-7.75){Jupiter}%
    \rput(5.5,-7.75){Saturn}%
    \rput(-6.5,-8.42){longitude at $^\mathrm{o}$}%
    \rput(-6.5,-9.42){latitude at $^\mathrm{o}$}%
    \rput(-6.5,-10.42){distance at U.A.}%
   \fi
\end{pspicture}}}
%
\catcode`\@=\PstAtCode\relax
%
\endinput