• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • astro
astr2lib.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2013 Gerhard Holtkamp
9 //
10 
11 /* =========================================================================
12  Procedures for calculating the positions of planets.
13  The procedures in this unit are taken from Montenbruck, Pfleger
14  "Astronomie mit dem Personal Computer", Springer Verlag, 1989
15  and modified correspondingly.
16  The library Astrolib has to be included.
17 
18  Copyright :Gerhard HOLTKAMP 21-SEP-2004 18:00
19  ========================================================================= */
20 
21 #include "astr2lib.h"
22 #include <cmath>
23 using namespace std;
24 
25 #include "attlib.h"
26 #include "astrolib.h"
27 
28 extern double frac (double f);
29 extern double atan21 (double y, double x);
30 
31 
32 /*-------------------- Class Plan200 --------------------------------------*/
33  /*
34  Ecliptic coordinates (in A.U.) and velocity (in A.U./day)
35  of the Planets for Equinox of Date given in Julian centuries since J2000.
36  ======================================================================
37  */
38 Plan200::Plan200 ()
39  { }
40 
41 void Plan200::addthe (double c1, double s1, double c2, double s2,
42  double& cc, double& ss)
43  {
44  cc=c1*c2-s1*s2;
45  ss=s1*c2+c1*s2;
46  }
47 
48 void Plan200::term (int i1, int i, int it, double dlc, double dls, double drc,
49  double drs, double dbc, double dbs)
50  {
51  if (it == 0) addthe (c3[i1],s3[i1],c[i],s[i],u,v);
52  else
53  {
54  u=u*tt;
55  v=v*tt;
56  }
57  dl = dl + dlc*u + dls*v;
58  dr = dr + drc*u + drs*v;
59  db = db + dbc*u + dbs*v;
60  }
61 
62 Vec3 Plan200::velocity() const // return last calculated planet velocity
63  {
64  return vp;
65  }
66 
67 void Plan200::state (Vec3& rs, Vec3& vs) const
68  {
69  /* State vector rs (position) and vs (velocity) of the Sun in
70  ecliptic of date coordinates for last calculated planet
71  */
72  rs = rp;
73  vs = vp;
74  }
75 
76 void Plan200::posvel ()
77  {
78  /* auxiliary program to calculate position and velocity
79  vectors rp, vp.
80  to be called by the various planet procedures.
81  */
82 
83  double cl, sl, cb, sb;
84 
85  cl = cos(l); sl = sin(l); cb = cos(b); sb = sin(b);
86  rp[0] = r*cl*cb; rp[1] = r*sl*cb; rp[2] = r*sb;
87 
88  // velocity
89  vp[0] = (dr*cl*cb - dl*r*sl*cb - db*r*cl*sb) * 1E-4;
90  vp[1] = (dr*sl*cb + dl*r*cl*cb - db*r*sl*sb) * 1E-4;
91  vp[2] = (dr*sb + db*r*cb) * 1E-4;
92 
93  }
94 
95 /*--------------------- Mercury ------------------------------------------*/
96 
97 Vec3 Plan200::Mercury (double t) // position of Mercury at time t
98  {
99  /*
100  Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day)
101  of Mercury for Equinox of Date.
102  t is the time in Julian centuries since J2000.
103  */
104 
105  const double arc = 206264.81; // 3600*180/pi = ''/r
106  const double p2 = M_PI * 2.0;
107 
108  int i;
109 
110  tt = t;
111  dl = 0.0; dr = 0.0; db = 0.0;
112  m1 = p2 * frac(0.4855407 + 415.2014314*t);
113  m2 = p2 * frac(0.1394222 + 162.5490444*t);
114  m3 = p2 * frac(0.9937861 + 99.9978139*t);
115  m5 = p2 * frac(0.0558417 + 8.4298417*t);
116  m6 = p2 * frac(0.8823333 + 3.3943333*t);
117  c3[1] = 1.0; s3[1]= 0.0;
118  c3[2] = cos(m1); s3[2] = sin(m1); c3[0] = c3[2]; s3[0] = -s3[2];
119  for (i=3; i<11; i++)
120  addthe(c3[i-1],s3[i-1],c3[2],s3[2],c3[i],s3[i]);
121 
122  // perturbations by Venus
123  c[5] = 1.0; s[5] = 0.0; c[4] = cos(m2); s[4] = -sin(m2);
124  for (i=4; i>0; i--)
125  addthe(c[i],s[i],c[4],s[4],c[i-1],s[i-1]);
126  term(2, 5, 0, 259.74, 84547.39, -78342.34,0.01,11683.22,21203.79);
127  term(2, 5, 1, 2.3, 5.04, -7.52, 0.02, 138.55, -71.01);
128  term(2, 5, 2, 0.01, -0.01, 0.01, 0.01, -0.19, -0.54);
129  term(3, 5, 0, -549.71, 10394.44, -7955.45, 0.0, 2390.29, 4306.79);
130  term(3, 5, 1, -4.77, 8.97, -1.53, 0.0, 28.49, -14.18);
131  term(3, 5, 2, 0.0, 0.0, 0.0, 0.0, -0.04, -0.11);
132  term(4, 5, 0, -234.04, 1748.74, -1212.86, 0.0, 535.41, 984.33);
133  term(4, 5, 1, -2.03, 3.48, -0.35, 0.0, 6.56, -2.91);
134  term(5, 5, 0, -77.64, 332.63, -219.23, 0.0, 124.4, 237.03);
135  term(5, 5, 1, -0.7, 1.1, -0.08, 0.0, 1.59, -0.59);
136  term(6, 5, 0, -23.59, 67.28, -43.54, 0.0, 29.44, 58.77);
137  term(6, 5, 1, -0.23, 0.32, -0.02, 0.0, 0.39, -0.11);
138  term(7, 5, 0, -6.86, 14.06, -9.18, 0.0, 7.03, 14.84);
139  term(7, 5, 1, -0.07, 0.09, -0.01, 0.0, 0.1, -0.02);
140  term(8, 5, 0, -1.94, 2.98, -2.02, 0.0, 1.69, 3.8);
141  term(9, 5, 0, -0.54, 0.63, -0.46, 0.0, 0.41, 0.98);
142  term(10, 5, 0, -0.15, 0.13, -0.11, 0.0, 0.1, 0.25);
143  term(0, 3, 0, -0.17, -0.06, -0.05, 0.14, -0.06, -0.07);
144  term(1, 4, 0, 0.24, -0.16, -0.11, -0.16, 0.04, -0.01);
145  term(1, 3, 0, -0.68, -0.25, -0.26, 0.73, -0.16, -0.18);
146  term(1, 0, 0, 0.37, 0.08, 0.06, -0.28, 0.13, 0.12);
147  term(2, 4, 0, 0.58, -0.41, 0.26, 0.36, 0.01, -0.01);
148  term(2, 3, 0, -3.51, -1.23, 0.23, -0.63, -0.05, -0.06);
149  term(2, 2, 0, 0.08, 0.53, -0.11, 0.04, 0.02, -0.09);
150  term(2, 0, 0, 1.44, 0.31, 0.3, -1.39, 0.34, 0.29);
151  term(3, 4, 0, 0.15, -0.11, 0.09, 0.12, 0.02, -0.04);
152  term(3, 3, 0, -1.99, -0.68, 0.65, -1.91, -0.2, 0.03);
153  term(3, 2, 0, -0.34, -1.28, 0.97, -0.26, 0.03, 0.03);
154  term(3, 1, 0, -0.33, 0.35, -0.13, -0.13, -0.01, 0.0);
155  term(3, 0, 0, 7.19, 1.56, -0.05, 0.12, 0.06, 0.05);
156  term(4, 3, 0, -0.52, -0.18, 0.13, -0.39, -0.16, 0.03);
157  term(4, 2, 0, -0.11, -0.42, 0.36, -0.1, -0.05, -0.05);
158  term(4, 1, 0, -0.19, 0.22, -0.23, -0.2, -0.01, 0.02);
159  term(4, 0, 0, 2.77, 0.49, -0.45, 2.56, 0.4, -0.12);
160  term(5, 0, 0, 0.67, 0.12, -0.09, 0.47, 0.24, -0.08);
161  term(6, 0, 0, 0.18, 0.03, -0.02, 0.12, 0.09, -0.03);
162 
163  // perturbations by Earth
164  c[4] = cos(m3); s[4] = -sin(m3);
165  for (i=4; i>1; i--)
166  addthe(c[i],s[i],c[4],s[4],c[i-1],s[i-1]);
167  term(1, 1, 0, -0.11, -0.07, -0.08, 0.11, -0.02, -0.04);
168  term(2, 4, 0, 0.1, -0.2, 0.15, 0.07, 0.0, 0.0);
169  term(2, 3, 0, -0.35, 0.28, -0.13, -0.17, -0.01, 0.0);
170  term(2, 1, 0, -0.67, -0.45, 0.0, 0.01, -0.01, -0.01);
171  term(3, 3, 0, -0.2, 0.16, -0.16, -0.2, -0.01, 0.02);
172  term(3, 2, 0, 0.13, -0.02, 0.02, 0.14, 0.01, 0.0);
173  term(3, 1, 0, -0.33, -0.18, 0.17, -0.31, -0.04, 0.0);
174 
175  // perturbations by Jupiter
176  c[4] = cos(m5); s[4] = -sin(m5);
177  for (i=4; i>2; i--)
178  addthe(c[i],s[i],c[4],s[4],c[i-1],s[i-1]);
179  term(0, 4, 0, -0.08, 0.16, 0.15, 0.08, -0.04, 0.01);
180  term(0, 3, 0, 0.1, -0.06, -0.07, -0.12, 0.07, -0.01);
181  term(1, 4, 0, -0.31, 0.48, -0.02, 0.13, -0.03, -0.02);
182  term(1, 3, 0, 0.42, -0.26, -0.38, -0.5, 0.2, -0.03);
183  term(2, 4, 0, -0.7, 0.01, -0.02, -0.63, 0.0, 0.03);
184  term(2, 3, 0, 2.61, -1.97, 1.74, 2.32, 0.01, 0.01);
185  term(2, 2, 0, 0.32, -0.15, 0.13, 0.28, 0.0, 0.0);
186  term(3, 4, 0, -0.18, 0.01, 0.0, -0.13, -0.03, 0.03);
187  term(3, 3, 0, 0.75, -0.56, 0.45, 0.6, 0.08, -0.17);
188  term(4, 3, 0, 0.2, -0.15, 0.1, 0.14, 0.04, -0.08);
189 
190  // perturbations by Saturn
191  c[3] = cos(2*m6); s[3] = -sin(2*m6);
192  term(2, 3, 0, -0.19, 0.33, 0.0, 0.0, 0.0, 0.0);
193 
194  dl = dl + (2.8 + 3.2*t);
195  l = p2 * frac(0.2151379 + m1/p2 + ((5601.7+1.1*t)*t+dl)/1296.0e3);
196  b = (-2522.15+(-30.18+0.04*t)*t+db) / arc;
197  r = 0.3952829 +0.0000016*t + dr*1.0e-6;
198 
199  dl = 714.0+292.66*cos(m1)+71.96*cos(2*m1)+18.16*cos(3*m1)
200  +4.61*cos(4*m1)+3.81*sin(2*m1)+2.43*sin(3*m1)+1.08*sin(4*m1);
201  dr = 55.94*sin(m1)+11.36*sin(2*m1)+2.6*sin(3*m1);
202  db = 73.4*cos(m1)+29.82*cos(2*m1)+10.22*cos(3*m1)+3.28*cos(4*m1)
203  -40.44*sin(m1)-16.55*sin(2*m1)-5.56*sin(3*m1)-1.72*sin(4*m1);
204 
205  posvel();
206 
207  return rp;
208  }
209 
210 
211 /*--------------------- Venus ------------------------------------------*/
212 
213 Vec3 Plan200::Venus (double t) // position of Venus at time t
214  {
215  /*
216  Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day)
217  of Venus for Equinox of Date.
218  t is the time in Julian centuries since J2000.
219  */
220 
221  const double arc = 206264.81; // 3600*180/pi = ''/r
222  const double p2 = M_PI * 2.0;
223 
224  int i;
225 
226  tt = t;
227  dl = 0.0; dr = 0.0; db = 0.0;
228  m1 = p2 * frac(0.4861431+415.2018375*t);
229  m2 = p2 * frac(0.1400197+162.5494552*t);
230  m3 = p2 * frac(0.9944153+99.9982208*t);
231  m4 = p2 * frac(0.0556297+53.1674631*t);
232  m5 = p2 * frac(0.0567028+8.4305083*t);
233  m6 = p2 * frac(0.8830539+3.3947206*t);
234 
235  c3[0] = 1.0; s3[0] = 0.0; c3[1] = cos(m2); s3[1] = sin(m2);
236  for (i=2; i<9; i++)
237  addthe(c3[i-1],s3[i-1],c3[1],s3[1],c3[i],s3[i]);
238 
239  // perturbations by Mercury
240  c[8] = 1.0; s[8] = 0.0; c[7] = cos(m1); s[7] = -sin(m1);
241  addthe(c[7],s[7],c[7],s[7],c[6],s[6]);
242  term(1, 7, 0, 0.0, 0.0, 0.06, -0.09, 0.01, 0.0);
243  term(2, 7, 0, 0.25, -0.09, -0.09, -0.27, 0.0, 0.0);
244  term(4, 6, 0, -0.07, -0.08, -0.14, 0.14, -0.01, -0.01);
245  term(5, 6, 0, -0.35, 0.08, 0.02, 0.09, 0.0, 0.0);
246 
247  // perturbations by Earth
248  c[7] = cos(m3); s[7] = -sin(m3);
249  for (i=7; i>0; i--)
250  addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]);
251  term(1, 8, 0, 2.37, 2793.23, -4899.07, 0.11, 9995.27, 7027.22);
252  term(1, 8, 1, 0.1, -19.65, 34.4, 0.22, 64.95, -86.1);
253  term(1, 8, 2, 0.06, 0.04, -0.07, 0.11, -0.55, -0.07);
254  term(2, 8, 0, -170.42, 73.13, -16.59, 0.0, 67.71, 47.56);
255  term(2, 8, 1, 0.93, 2.91, 0.23, 0.0, -0.03, -0.92);
256  term(3, 8, 0, -2.31, 0.9, -0.08, 0.0, 0.04, 2.09);
257  term(1, 7, 0, -2.38, -4.27, 3.27, -1.82, 0.0, 0.0);
258  term(1, 6, 0, 0.09, 0.0, -0.08, 0.05, -0.02, -0.25);
259  term(2, 6, 0, -9.57, -5.93, 8.57, -13.83, -0.01, -0.01);
260  term(2, 5, 0, -2.47, -2.4, 0.83, -0.95, 0.16, 0.24);
261  term(3, 6, 0, -0.09, -0.05, 0.08, -0.13, -0.28, 0.12);
262  term(3, 5, 0, 7.12, 0.32, -0.62, 13.76, -0.07, 0.01);
263  term(3, 4, 0, -0.65, -0.17, 0.18, -0.73, 0.1, 0.05);
264  term(3, 3, 0, -1.08, -0.95, -0.17, 0.22, -0.03, -0.03);
265  term(4, 5, 0, 0.06, 0.0, -0.01, 0.08, 0.14, -0.18);
266  term(4, 4, 0, 0.93, -0.46, 1.06, 2.13, -0.01, 0.01);
267  term(4, 3, 0, -1.53, 0.38, -0.64, -2.54, 0.27, 0.0);
268  term(4, 2, 0, -0.17, -0.05, 0.03, -0.11, 0.02, 0.0);
269  term(5, 3, 0, 0.18, -0.28, 0.71, 0.47, -0.02, 0.04);
270  term(5, 2, 0, 0.15, -0.14, 0.3, 0.31, -0.04, 0.03);
271  term(5, 1, 0, -0.08, 0.02, -0.03, -0.11, 0.01, 0.0);
272  term(5, 0, 0, -0.23, 0.0, 0.01, -0.04, 0.0, 0.0);
273  term(6, 2, 0, 0.01, -0.14, 0.39, 0.04, 0.0, -0.01);
274  term(6, 1, 0, 0.02, -0.05, 0.12, 0.04, -0.01, 0.01);
275  term(6, 0, 0, 0.1, -0.1, 0.19, 0.19, -0.02, 0.02);
276  term(7, 1, 0, -0.03, -0.06, 0.18, -0.08, 0.0, 0.0);
277  term(8, 0, 0, -0.03, -0.02, 0.06, -0.08, 0.0, 0.0);
278 
279  // perturbations by Mars
280  c[7] = cos(m4); s[7] = -sin(m4);
281  for (i=7; i>5; i--)
282  addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]);
283  term(1, 5, 0, -0.65, 1.02, -0.04, -0.02, -0.02, 0.0);
284  term(2, 6, 0, -0.05, 0.04, -0.09, -0.1, 0.0, 0.0);
285  term(2, 5, 0, -0.5, 0.45, -0.79, -0.89, 0.01, 0.03);
286 
287  // perturbations by Jupiter
288  c[7] = cos(m5); s[7] = -sin(m5);
289  for (i=7; i>5; i--)
290  addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]);
291  term(0, 7, 0, -0.05, 1.56, 0.16, 0.04, -0.08, -0.04);
292  term(1, 7, 0, -2.62, 1.4, -2.35, -4.4, 0.02, 0.03);
293  term(1, 6, 0, -0.47, -0.08, 0.12, -0.76, 0.04, -0.18);
294  term(2, 6, 0, -0.73, -0.51, 1.27, -1.82, -0.01, 0.01);
295  term(2, 5, 0, -0.14, -0.1, 0.25, -0.34, 0.0, 0.0);
296  term(3, 5, 0, -0.01, 0.04, -0.11, -0.02, 0.0, 0.0);
297 
298  // perturbations by Saturn
299  c[7] = cos(m6); s[7] = -sin(m6);
300  term(0, 7, 0, 0.0, 0.21, 0.0, 0.0, 0.0, -0.01);
301  term(1, 7, 0, -0.11, -0.14, 0.24, -0.2, 0.01, 0.0);
302 
303  dl = dl+2.74*sin(p2*(0.0764+0.4174*t))+0.27*sin(p2*(0.9201+0.3307*t));
304  dl = dl+(1.9+1.8*t);
305 
306  l = p2 * frac(0.3654783 + m2/p2 + ((5071.2+1.1*t)*t+dl)/1296.0e3);
307  b = (-67.7+(0.04+0.01*t)*t+db)/arc;
308  r = 0.7233482-0.0000002*t+dr*1.0e-6;
309 
310  dl = 280.0+3.79*cos(m2);
311  dr = 1.37*sin(m2);
312  db = 9.54*cos(m2)-13.57*sin(m2);
313 
314  posvel();
315 
316  return rp;
317  }
318 
319 /*--------------------- Mars ------------------------------------------*/
320 
321 Vec3 Plan200::Mars (double t) // position of Mars at time t
322  {
323  /*
324  Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day)
325  of Mars for Equinox of Date.
326  t is the time in Julian centuries since J2000.
327  */
328 
329  const double arc = 206264.81; // 3600*180/pi = ''/r
330  const double p2 = M_PI * 2.0;
331 
332  int i;
333 
334  tt = t;
335  dl = 0.0; dr = 0.0; db = 0.0;
336  m2 = p2 * frac(0.1382208+162.5482542*t);
337  m3 = p2 * frac(0.9926208+99.9970236*t);
338  m4 = p2 * frac(0.0538553+53.1662736*t);
339  m5 = p2 * frac(0.0548944+8.4290611*t);
340  m6 = p2 * frac(0.8811167+3.3935250*t);
341  c3[2] = 1.0; s3[2] = 0.0; c3[3] = cos(m4); s3[3] = sin(m4);
342  for (i=4; i<19; i++)
343  addthe(c3[i-1],s3[i-1],c3[3],s3[3],c3[i],s3[i]);
344  c3[0] = c3[4];
345  s3[0] = -s3[4];
346  c3[1] = c3[3];
347  s3[1] = -s3[3];
348 
349  // perturbations by Venus
350  c[9] = 1.0; s[9] = 0.0; c[8] = cos(m2); s[8] = -sin(m2);
351  addthe (c[8],s[8],c[8],s[8],c[7],s[7]);
352  term(2, 8, 0, -0.01, -0.03, 0.1, -0.04, 0.0, 0.0);
353  term(3, 8, 0, 0.05, 0.1, -2.08, 0.75, 0.0, 0.0);
354  term(4, 8, 0, -0.25, -0.57, -2.58, 1.18, 0.05, -0.04);
355  term(4, 7, 0, 0.02, 0.02, 0.13, -0.14, 0.0, 0.0);
356  term(5, 8, 0, 3.41, 5.38, 1.87, -1.15, 0.01, -0.01);
357  term(5, 7, 0, 0.02, 0.02, 0.11, -0.13, 0.0, 0.0);
358  term(6, 8, 0, 0.32, 0.49, -1.88, 1.21, -0.07, 0.07);
359  term(6, 7, 0, 0.03, 0.03, 0.12, -0.14, 0.0, 0.0);
360  term(7, 8, 0, 0.04, 0.06, -0.17, 0.11, -0.01, 0.01);
361  term(7, 7, 0, 0.11, 0.09, 0.35, -0.43, -0.01, 0.01);
362  term(8, 7, 0, -0.36, -0.28, -0.2, 0.25, 0.0, 0.0);
363  term(9, 7, 0, -0.03, -0.03, 0.11, -0.13, 0.0, 0.0);
364 
365  // perturbations by Earth
366  c[8] = cos(m3); s[8] = -sin(m3);
367  for (i=8; i>0; i--)
368  addthe(c[i],s[i],c[8],s[8],c[i-1],s[i-1]);
369  term(3, 9, 0, -5.32, 38481.97, -141856.04, 0.4, -6321.67, 1876.89);
370  term(3, 9, 1, -1.12, 37.98, -138.67, -2.93, 37.28, 117.48);
371  term(3, 9, 2, -0.32, -0.03, 0.12, -1.19, 1.04, -0.4);
372  term(4, 9, 0, 28.28, 2285.8, -6608.37, 0.0, -589.35, 174.81);
373  term(4, 9, 1, 1.64, 3.37, -12.93, 0.0, 2.89, 11.1);
374  term(4, 9, 2, 0.0, 0.0, 0.0, 0.0, 0.1, -0.03);
375  term(5, 9, 0, 5.31, 189.29, -461.81, 0.0, -61.98, 18.53);
376  term(5, 9, 1, 0.31, 0.35, -1.36, 0.0, 0.25, 1.19);
377  term(6, 9, 0, 0.81, 17.96, -38.26, 0.0, -6.88, 2.08);
378  term(6, 9, 1, 0.05, 0.04, -0.15, 0.0, 0.02, 0.14);
379  term(7, 9, 0, 0.11, 1.83, -3.48, 0.0, -0.79, 0.24);
380  term(8, 9, 0, 0.02, 0.2, -0.34, 0.0, -0.09, 0.3);
381  term(1, 8, 0, 0.09, 0.06, 0.14, -0.22, 0.02, -0.02);
382  term(2, 8, 0, 0.72, 0.49, 1.55, -2.31, 0.12, -0.1);
383  term(3, 8, 0, 7.0, 4.92, 13.93, -20.48, 0.08, -0.13);
384  term(4, 8, 0, 13.08, 4.89, -4.53, 10.01, -0.05, 0.13);
385  term(4, 7, 0, 0.14, 0.05, -0.48, -2.66, 0.01, 0.14);
386  term(5, 8, 0, 1.38, 0.56, -2.0, 4.85, -0.01, 0.19);
387  term(5, 7, 0, -6.85, 2.68, 8.38, 21.42, 0.0, 0.03);
388  term(5, 6, 0, -0.08, 0.2, 1.2, 0.46, 0.0, 0.0);
389  term(6, 8, 0, 0.16, 0.07, -0.19, 0.47, -0.01, 0.05);
390  term(6, 7, 0, -4.41, 2.14, -3.33, -7.21, -0.07, -0.09);
391  term(6, 6, 0, -0.12, 0.33, 2.22, 0.72, -0.03, -0.02);
392  term(6, 5, 0, -0.04, -0.06, -0.36, 0.23, 0.0, 0.0);
393  term(7, 7, 0, -0.44, 0.21, -0.7, -1.46, -0.06, -0.07);
394  term(7, 6, 0, 0.48, -2.6, -7.25, -1.37, 0.0, 0.0);
395  term(7, 5, 0, -0.09, -0.12, -0.66, 0.5, 0.0, 0.0);
396  term(7, 4, 0, 0.03, 0.0, 0.01, -0.17, 0.0, 0.0);
397  term(8, 7, 0, -0.05, 0.03, -0.07, -0.15, -0.01, -0.01);
398  term(8, 6, 0, 0.1, -0.96, 2.36, 0.3, 0.04, 0.0);
399  term(8, 5, 0, -0.17, -0.2, -1.09, 0.94, 0.02, -0.02);
400  term(8, 4, 0, 0.05, 0.0, 0.0, -0.3, 0.0, 0.0);
401  term(9, 6, 0, 0.01, -0.1, 0.32, 0.04, 0.02, 0.0);
402  term(9, 5, 0, 0.86, 0.77, 1.86, -2.01, 0.01, -0.01);
403  term(9, 4, 0, 0.09, -0.01, -0.05, -0.44, 0.0, 0.0);
404  term(9, 3, 0, -0.01, 0.02, 0.1, 0.08, 0.0, 0.0);
405  term(10, 5, 0, 0.2, 0.16, -0.53, 0.64, -0.01, 0.02);
406  term(10, 4, 0, 0.17, -0.03, -0.14, -0.84, 0.0, 0.01);
407  term(10, 3, 0, -0.02, 0.03, 0.16, 0.09, 0.0, 0.0);
408  term(11, 4, 0, -0.55, 0.15, 0.3, 1.1, 0.0, 0.0);
409  term(11, 3, 0, -0.02, 0.04, 0.2, 0.1, 0.0, 0.0);
410  term(12, 4, 0, -0.09, 0.03, -0.1, -0.33, 0.0, -0.01);
411  term(12, 3, 0, -0.05, 0.11, 0.48, 0.21, -0.01, 0.0);
412  term(13, 3, 0, 0.1, -0.35, -0.52, -0.15, 0.0, 0.0);
413  term(13, 2, 0, -0.01, -0.02, -0.1, 0.07, 0.0, 0.0);
414  term(14, 3, 0, 0.01, -0.04, 0.18, 0.4, 0.01, 0.0);
415  term(14, 2, 0, -0.05, -0.07, -0.29, 0.2, 0.01, 0.0);
416  term(15, 2, 0, 0.23, 0.27, 0.25, -0.21, 0.0, 0.0);
417  term(16, 2, 0, 0.02, 0.03, -0.1, 0.09, 0.0, 0.0);
418  term(16, 1, 0, 0.05, 0.01, 0.03, -0.23, 0.0, 0.3);
419  term(17, 1, 0, -1.53, 0.27, 0.06, 0.42, 0.0, 0.0);
420  term(18, 1, 0, -0.14, 0.02, -0.1, -0.55, -0.01, -0.02);
421  term(18, 0, 0, 0.03, -0.06, -0.25, -0.11, 0.0, 0.0);
422 
423  // perturbation by Jupiter
424  c[8] = cos(m5); s[8] = -sin(m5);
425  for (i=8; i>4; i--)
426  addthe(c[i],s[i],c[8],s[8],c[i-1],s[i-1]);
427  term(0, 8, 0, 0.05, 0.03, 0.08, -0.14, 0.01, -0.01);
428  term(1, 8, 0, 0.39, 0.27, 0.92, -1.5, -0.03, -0.06);
429  term(1, 7, 0, -0.16, 0.03, 0.13, 0.67, -0.01, 0.06);
430  term(1, 6, 0, -0.02, 0.01, 0.05, 0.09, 0.0, 0.01);
431  term(2, 8, 0, 3.56, 1.13, -5.41, -7.18, -0.25, -0.24);
432  term(2, 7, 0, -1.44, 0.25, 1.24, 7.96, 0.02, 0.31);
433  term(2, 6, 0, -0.21, 0.11, 0.55, 1.04, 0.01, 0.05);
434  term(2, 5, 0, -0.02, 0.02, 0.11, 0.11, 0.0, 0.01);
435  term(3, 8, 0, 16.67, -19.15, 61.0, 53.36, -0.06, -0.07);
436  term(3, 7, 0, -21.64, 3.18, -7.77, -54.64, -0.31, 0.5);
437  term(3, 6, 0, -2.82, 1.45, -2.53, -5.73, 0.01, 0.07);
438  term(3, 5, 0, -0.31, 0.28, -0.34, -0.51, 0.0, 0.0);
439  term(4, 8, 0, 2.15, -2.29, 7.04, 6.94, 0.33, 0.19);
440  term(4, 7, 0, -15.69, 3.31, -15.7, -73.17, -0.17, -0.25);
441  term(4, 6, 0, -1.73, 1.95, -9.19, -7.2, 0.02, -0.03);
442  term(4, 5, 0, -0.01, 0.33, -1.42, 0.08, 0.01, -0.01);
443  term(4, 4, 0, 0.03, 0.03, -0.13, 0.12, 0.0, 0.0);
444  term(5, 8, 0, 0.26, -0.28, 0.73, 0.71, 0.08, 0.04);
445  term(5, 7, 0, -2.06, 0.46, -1.61, -6.72, -0.13, -0.25);
446  term(5, 6, 0, -1.28, -0.27, 2.21, -6.9, -0.04, -0.02);
447  term(5, 5, 0, -0.22, 0.08, -0.44, -1.25, 0.0, 0.01);
448  term(5, 4, 0, -0.02, 0.03, -0.15, -0.08, 0.0, 0.0);
449  term(6, 8, 0, 0.03, -0.03, 0.08, 0.08, 0.01, 0.01);
450  term(6, 7, 0, -0.26, 0.06, -0.17, -0.7, -0.03, -0.05);
451  term(6, 6, 0, -0.2, -0.05, 0.22, -0.79, -0.01, -0.02);
452  term(6, 5, 0, -0.11, -0.14, 0.93, -0.6, 0.0, 0.0);
453  term(6, 4, 0, -0.04, -0.02, 0.09, -0.23, 0.0, 0.0);
454  term(7, 5, 0, -0.02, -0.03, 0.13, -0.09, 0.0, 0.0);
455  term(7, 4, 0, 0.0, -0.03, 0.21, 0.01, 0.0, 0.0);
456 
457  // perturbations by Saturn
458  c[8] = cos(m6); s[8] = -sin(m6);
459  for (i=8; i>5; i--)
460  addthe(c[i],s[i],c[8],s[8],c[i-1],s[i-1]);
461  term(1, 8, 0, 0.03, 0.13, 0.48, -0.13, 0.02, 0.0);
462  term(2, 8, 0, 0.27, 0.84, 0.4, -0.43, 0.01, -0.01);
463  term(2, 7, 0, 0.12, -0.04, -0.33, -0.55, -0.01, -0.02);
464  term(2, 6, 0, 0.02, -0.01, -0.07, -0.08, 0.0, 0.0);
465  term(3, 8, 0, 1.12, 0.76, -2.66, 3.91, -0.01, 0.01);
466  term(3, 7, 0, 1.49, -0.95, 3.07, 4.83, 0.04, -0.05);
467  term(3, 6, 0, 0.21, -0.18, 0.55, 0.64, 0.0, 0.0);
468  term(4, 8, 0, 0.12, 0.1, -0.29, 0.34, -0.01, 0.02);
469  term(4, 7, 0, 0.51, -0.36, 1.61, 2.25, 0.03, 0.01);
470  term(4, 6, 0, 0.1, -0.1, 0.5, 0.43, 0.0, 0.0);
471  term(4, 5, 0, 0.01, -0.02, 0.11, 0.05, 0.0, 0.0);
472  term(5, 7, 0, 0.07, -0.05, 0.16, 0.22, 0.01, 0.01);
473 
474  dl = dl+52.49*sin(p2*(0.1868+0.0549*t))+0.61*sin(p2*(0.922+0.3307*t))
475  +0.32*sin(p2*(0.4731+2.1485*t))+0.28*sin(p2*(0.9467+1.1133*t));
476  dl = dl + (0.14+0.87*t-0.11*t*t);
477  l = p2 * frac(0.9334591+m4/p2+((6615.5+1.1*t)*t+dl)/1296.0e3);
478  r = 1.5303352 + 0.0000131*t + dr*1.0e-6;
479  b = (596.32+(-2.92-0.1*t)*t+db) / arc;
480 
481  dl = 91.50 + 17.07*cos(m4) + 2.03*cos(2*m4);
482  dr = 12.98*sin(m4) + 1.21*cos(2*m4);
483  db = 0.83*cos(m4) + 2.8*sin(m4);
484 
485  posvel();
486 
487  return rp;
488  }
489 
490 /*--------------------- Jupiter ------------------------------------------*/
491 
492 Vec3 Plan200::Jupiter (double t) // position of Jupiter at time t
493  {
494  /*
495  Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day)
496  of Jupiter for Equinox of Date.
497  t is the time in Julian centuries since J2000.
498  */
499 
500  const double arc = 206264.81; // 3600*180/pi = ''/r
501  const double p2 = M_PI * 2.0;
502 
503  int i;
504 
505  tt = t;
506  dl = 0.0; dr = 0.0; db = 0.0;
507  m5 = p2 * frac(0.0565314+8.4302963*t);
508  m6 = p2 * frac(0.8829867+3.3947688*t);
509  m7 = p2 * frac(0.3969537+1.1902586*t);
510  c3[1] = 1.0; s3[1] = 0.0;
511  c3[2] = cos(m5); s3[2] = sin(m5); c3[0] = c3[2]; s3[0] = -s3[2];
512  for (i=3; i<7; i++)
513  addthe(c3[i-1],s3[i-1],c3[2],s3[2],c3[i],s3[i]);
514 
515  // perturbations by Saturn
516  c[10] = 1.0; s[10] = 0.0; c[9] = cos(m6); s[9] = -sin(m6);
517  for (i=9; i>0; i--)
518  addthe(c[i],s[i],c[9],s[9],c[i-1],s[i-1]);
519  term(0, 9, 0, -0.2, 1.4, 2.0, 0.6, 0.1, -0.2);
520  term(1, 9, 0, 9.4, 8.9, 3.9, -8.3, -0.4, -1.4);
521  term(1, 8, 0, 5.6, -3.0, -5.4, -5.7, -2.0, 0.0);
522  term(1, 7, 0, -4.0, -0.1, 0.0, 5.5, 0.0, 0.0);
523  term(1, 5, 0, 3.3, -1.6, -1.6, -3.1, -0.5, -1.2);
524  term(2, 10, 0, -113.1, 19998.6, -25208.2, -142.2, -4670.7, 288.9);
525  term(2, 10, 1, -76.1, 66.9, -84.2, -95.8, 21.6, 29.4);
526  term(2, 10, 2, -0.5, -0.3, 0.4, -0.7, 0.1, -0.1);
527  term(2, 9, 0, 78.8, -14.5, 11.5, 64.4, -0.2, 0.2);
528  term(2, 8, 0, -2.0, -132.4, 28.8, 4.3, -1.7, 0.4);
529  term(2, 8, 1, -1.1, -0.7, 0.2, -0.3, 0.0, 0.0);
530  term(2, 7, 0, -7.5, -6.8, -0.4, -1.1, 0.6, -0.9);
531  term(2, 6, 0, 0.7, 0.7, 0.6, -1.1, 0.0, -0.2);
532  term(2, 5, 0, 51.5, -26.0, -32.5, -64.4, -4.9, -12.4);
533  term(2, 5, 1, -1.2, -2.2, -2.7, 1.5, -0.4, 0.3);
534  term(3, 10, 0, -3.4, 632.0, -610.6, -6.5, -226.8, 12.7);
535  term(3, 10, 1, -4.2, 3.8, -4.1, -4.5, 0.2, 0.6);
536  term(3, 9, 0, 5.3, -0.7, 0.7, 6.1, 0.2, 1.1);
537  term(3, 8, 0, -76.4, -185.1, 260.2, -108.0, 1.6, 0.0);
538  term(3, 7, 0, 66.7, 47.8, -51.4, 69.8, 0.9, 0.3);
539  term(3, 7, 1, 0.6, -1.0, 1.0, 0.6, 0.0, 0.0);
540  term(3, 6, 0, 17.0, 1.4, -1.8, 9.6, 0.0, -0.1);
541  term(3, 5, 0, 1066.2, -518.3, -1.3, -23.9, 1.8, -0.3);
542  term(3, 5, 1, -25.4, -40.3, -0.9, 0.3, 0.0, 0.0);
543  term(3, 5, 2, -0.7, 0.5, 0.0, 0.0, 0.0, 0.0);
544  term(4, 10, 0, -0.1, 28.0, -22.1, -0.2, -12.5, 0.7);
545  term(4, 8, 0, -5.0, -11.5, 11.7, -5.4, 2.1, -1.0);
546  term(4, 7, 0, 16.9, -6.4, 13.4, 26.9, -0.5, 0.8);
547  term(4, 6, 0, 7.2, -13.3, 20.9, 10.5, 0.1, -0.1);
548  term(4, 5, 0, 68.5, 134.3, -166.9, 86.5, 7.1, 15.2);
549  term(4, 5, 1, 3.5, -2.7, 3.4, 4.3, 0.5, -0.4);
550  term(4, 4, 0, 0.6, 1.0, -0.9, 0.5, 0.0, 0.0);
551  term(4, 3, 0, -1.1, 1.7, -0.4, -0.2, 0.0, 0.0);
552  term(5, 10, 0, 0.0, 1.4, -1.0, 0.0, -0.6, 0.0);
553  term(5, 8, 0, -0.3, -0.7, 0.4, -0.2, 0.2, -0.1);
554  term(5, 7, 0, 1.1, -0.6, 0.9, 1.2, 0.1, 0.2);
555  term(5, 6, 0, 3.2, 1.7, -4.1, 5.8, 0.2, 0.1);
556  term(5, 5, 0, 6.7, 8.7, -9.3, 8.7, -1.1, 1.6);
557  term(5, 4, 0, 1.5, -0.3, 0.6, 2.4, 0.0, 0.0);
558  term(5, 3, 0, -1.9, 2.3, -3.2, -2.7, 0.0, -0.1);
559  term(5, 2, 0, 0.4, -1.8, 1.9, 0.5, 0.0, 0.0);
560  term(5, 1, 0, -0.2, -0.5, 0.3, -0.1, 0.0, 0.0);
561  term(5, 0, 0, -8.6, -6.8, -0.4, 0.1, 0.0, 0.0);
562  term(5, 0, 1, -0.5, 0.6, 0.0, 0.0, 0.0, 0.0);
563  term(6, 5, 0, -0.1, 1.5, -2.5, -0.8, -0.1, 0.1);
564  term(6, 4, 0, 0.1, 0.8, -1.6, 0.1, 0.0, 0.0);
565  term(6, 1, 0, -0.5, -0.1, 0.1, -0.8, 0.0, 0.0);
566  term(6, 0, 0, 2.5, -2.2, 2.8, 3.1, 0.1, -0.2);
567 
568  // perturbations by Uranus
569  c[9] = cos(m7); s[9] = -sin(m7);
570  addthe(c[9],s[9],c[9],s[9],c[8],s[8]);
571  term(2, 9, 0, 0.4, 0.9, 0.0, 0.0, 0.0, 0.0);
572  term(2, 8, 0, 0.4, 0.4, -0.4, 0.3, 0.0, 0.0);
573 
574  // perturbations by Saturn and Uranus
575  double phi, x, y;
576 
577  phi = (2*m5-6*m6+3*m7); x = cos(phi); y = sin(phi);
578  dl = dl-0.8*x+8.5*y; dr = dr-0.1*x;
579  addthe(x,y,c3[2],s3[2],x,y);
580  dl = dl+0.4*x+0.5*y; dr = dr-0.7*x+0.5*y; db = db-0.1*x;
581 
582  l = p2 * frac(0.0388910 + m5/p2 + ((5025.2+0.8*t)*t+dl)/1296.0e3);
583  b = (227.3 - 0.3*t + db) / arc;
584  r = 5.208873 + 0.000041*t + dr*1.0e-5;
585 
586  dl = 14.5+1.41*cos(m5); dr = 3.66*sin(m5); db = 0.33*sin(m5);
587 
588  posvel();
589 
590  return rp;
591  }
592 
593 
594 /*--------------------- Saturn ------------------------------------------*/
595 
596 Vec3 Plan200::Saturn (double t) // position of Saturn at time t
597  {
598  /*
599  Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day)
600  of Saturn for Equinox of Date.
601  t is the time in Julian centuries since J2000.
602  */
603 
604  const double arc = 206264.81; // 3600*180/pi = ''/r
605  const double p2 = M_PI * 2.0;
606 
607  int i;
608 
609  tt = t;
610  dl = 0.0; dr = 0.0; db = 0.0;
611  m5 = p2 * frac(0.0565314+8.4302963*t);
612  m6 = p2 * frac(0.8829867+3.3947688*t);
613  m7 = p2 * frac(0.3969537+1.1902586*t);
614  m8 = p2 * frac(0.7208473+0.6068623*t);
615  c3[0] = 1.0; s3[0] = 0.0; c3[1] = cos(m6); s3[1] = sin(m6);
616  for (i=2; i<12; i++)
617  addthe(c3[i-1],s3[i-1],c3[1],s3[1],c3[i],s3[i]);
618 
619  // perturbations by Jupiter
620  c[6] = 1.0; s[6] = 0.0; c[7] = cos(m5); s[7] = sin(m5);
621  for (i=6; i>0; i--)
622  addthe(c[i],s[i],c[7],-s[7],c[i-1],s[i-1]);
623  term(0, 5, 0, 12.0, -1.4, -13.9, 6.4, 1.2, -1.8);
624  term(0, 4, 0, 0.0, -0.2, -0.9, 1.0, 0.0, -0.1);
625  term(1, 7, 0, 0.9, 0.4, -1.8, 1.9, 0.2, 0.2);
626  term(1, 6, 0, -348.3, 22907.7, -52915.5, -752.2, -3266.5, 8314.4);
627  term(1, 6, 1, -225.2, -146.2, 337.7, -521.3, 79.6, 17.4);
628  term(1, 6, 2, 1.3, -1.4, 3.2, 2.9, 0.1, -0.4);
629  term(1, 5, 0, -1.0, -30.7, 108.6, -815.0, -3.6, -9.3);
630  term(1, 4, 0, -2.0, -2.7, -2.1, -11.9, -0.1, -0.4);
631  term(2, 7, 0, 0.1, 0.2, -1.0, 0.3, 0.0, 0.0);
632  term(2, 6, 0, 44.2, 724.0, -1464.3, -34.7, -188.7, 459.1);
633  term(2, 6, 1, -17.0, -11.3, 18.9, -28.9, 1.0, -3.7);
634  term(2, 5, 0, -3.5, -426.6, -546.5, -26.5, -1.6, -2.7);
635  term(2, 5, 1, 3.5, -2.2, -2.6, -4.3, 0.0, 0.0);
636  term(2, 4, 0, 10.5, -30.9, -130.5, -52.3, -1.9, 0.2);
637  term(2, 3, 0, -0.2, -0.4, -1.2, -0.1, -0.1, 0.0);
638  term(3, 6, 0, 6.5, 30.5, -61.1, 0.4, -11.6, 28.1);
639  term(3, 6, 1, -1.2, -0.7, 1.1, -1.8, -0.2, -0.6);
640  term(3, 5, 0, 29.0, -40.2, 98.2, 45.3, 3.2, -9.4);
641  term(3, 5, 1, 0.6, 0.6, -1.0, 1.3, 0.0, 0.0);
642  term(3, 4, 0, -27.0, -21.1, -68.5, 8.1, -19.8, 5.4);
643  term(3, 4, 1, 0.9, -0.5, -0.4, -2.0, -0.1, -0.8);
644  term(3, 3, 0, -5.4, -4.1, -19.1, 26.2, -0.1, -0.1);
645  term(4, 6, 0, 0.6, 1.4, -3.0, -0.2, -0.6, 1.6);
646  term(4, 5, 0, 1.5, -2.5, 12.4, 4.7, 1.0, -1.1);
647  term(4, 4, 0, -821.9, -9.6, -26.0, 1873.6, -70.5, -4.4);
648  term(4, 4, 1, 4.1, -21.9, -50.3, -9.9, 0.7, -3.0);
649  term(4, 3, 0, -2.0, -4.7, -19.3, 8.2, -0.1, -0.3);
650  term(4, 2, 0, -1.5, 1.3, 6.5, 7.3, 0.0, 0.0);
651  term(5, 4, 0, -2627.6, -1277.3, 117.4, -344.1, -13.8, -4.3);
652  term(5, 4, 1, 63.0, -98.6, 12.7, 6.7, 0.1, -0.2);
653  term(5, 4, 2, 1.7, 1.2, -0.2, 0.3, 0.0, 0.0);
654  term(5, 3, 0, 0.4, -3.6, -11.3, -1.6, 0.0, -0.3);
655  term(5, 2, 0, -1.4, 0.3, 1.5, 6.3, -0.1, 0.0);
656  term(5, 1, 0, 0.3, 0.6, 3.0, -1.7, 0.0, 0.0);
657  term(6, 4, 0, -146.7, -73.7, 166.4, -334.3, -43.6, -46.7);
658  term(6, 4, 1, 5.2, -6.8, 15.1, 11.4, 1.7, -1.0);
659  term(6, 3, 0, 1.5, -2.9, -2.2, -1.3, 0.1, -0.1);
660  term(6, 2, 0, -0.7, -0.2, -0.7, 2.8, 0.0, 0.0);
661  term(6, 1, 0, 0.0, 0.5, 2.5, -0.1, 0.0, 0.0);
662  term(6, 0, 0, 0.3, -0.1, -0.3, -1.2, 0.0, 0.0);
663  term(7, 4, 0, -9.6, -3.9, 9.6, -18.6, -4.7, -5.3);
664  term(7, 4, 1, 0.4, -0.5, 1.0, 0.9, 0.3, -0.1);
665  term(7, 3, 0, 3.0, 5.3, 7.5, -3.5, 0.0, 0.0);
666  term(7, 2, 0, 0.2, 0.4, 1.6, -1.3, 0.0, 0.0);
667  term(7, 1, 0, -0.1, 0.2, 1.0, 0.5, 0.0, 0.0);
668  term(7, 0, 0, 0.2, 0.0, 0.2, -1.0, 0.0, 0.0);
669  term(8, 4, 0, -0.7, -0.2, 0.6, -1.2, -0.4, -0.4);
670  term(8, 3, 0, 0.5, 1.0, -2.0, 1.5, 0.1, 0.2);
671  term(8, 2, 0, 0.4, 1.3, 3.6, -0.9, 0.0, -0.1);
672  term(9, 2, 0, 4.0, -8.7, -19.9, -9.9, 0.2, -0.4);
673  term(9, 2, 1, 0.5, 0.3, 0.8, -1.8, 0.0, 0.0);
674  term(10, 2, 0, 21.3, -16.8, 3.3, 3.3, 0.2, -0.2);
675  term(10, 2, 1, 1.0, 1.7, -0.4, 0.4, 0.0, 0.0);
676  term(11, 2, 0, 1.6, -1.3, 3.0, 3.7, 0.8, -0.2);
677 
678  // perturbations by Uranus
679  c[5] = cos(m7); s[5] = -sin(m7);
680  for (i=5; i>1; i--)
681  addthe(c[i],s[i],c[5],s[5],c[i-1],s[i-1]);
682  term(0, 5, 0, 1.0, 0.7, 0.4, -1.5, 0.1, 0.0);
683  term(0, 4, 0, 0.0, -0.4, -1.1, 0.1, -0.1, -0.1);
684  term(0, 3, 0, -0.9, -1.2, -2.7, 2.1, -0.5, -0.3);
685  term(1, 5, 0, 7.8, -1.5, 2.3, 12.7, 0.0, 0.0);
686  term(1, 4, 0, -1.1, -8.1, 5.2, -0.3, -0.3, -0.3);
687  term(1, 3, 0, -16.4, -21.0, -2.1, 0.0, 0.4, 0.0);
688  term(2, 5, 0, 0.6, -0.1, 0.1, 1.2, 0.1, 0.0);
689  term(2, 4, 0, -4.9, -11.7, 31.5, -13.3, 0.0, -0.2);
690  term(2, 3, 0, 19.1, 10.0, -22.1, 42.1, 0.1, -1.1);
691  term(2, 2, 0, 0.9, -0.1, 0.1, 1.4, 0.0, 0.0);
692  term(3, 4, 0, -0.4, -0.9, 1.7, -0.8, 0.0, -0.3);
693  term(3, 3, 0, 2.3, 0.0, 1.0, 5.7, 0.3, 0.3);
694  term(3, 2, 0, 0.3, -0.7, 2.0, 0.7, 0.0, 0.0);
695  term(3, 1, 0, -0.1, -0.4, 1.1, -0.3, 0.0, 0.0);
696 
697  // perturbations by Neptune
698  c[5] = cos(m8); s[5] = -sin(m8);
699  addthe(c[5],s[5],c[5],s[5],c[4],s[4]);
700  term(1, 5, 0, -1.3, -1.2, 2.3, -2.5, 0.0, 0.0);
701  term(1, 4, 0, 1.0, -0.1, 0.1, 1.4, 0.0, 0.0);
702  term(2, 4, 0, 1.1, -0.1, 0.2, 3.3, 0.0, 0.0);
703 
704  // perturbations by Jupiter and Uranus
705  double phi, x, y;
706 
707  phi = (-2*m5+5*m6-3*m7); x = cos(phi); y = sin(phi);
708  dl = dl-0.8*x-0.1*y; dr = dr-0.2*x+1.8*y; db = db+0.3*x+0.5*y;
709  addthe(x,y,c3[1],s3[1],x,y);
710  dl = dl+(2.4-0.7*t)*x+(27.8-0.4*t)*y;
711  dr = dr+2.1*x-0.2*y;
712  addthe(x,y,c3[1],s3[1],x,y);
713  dl = dl+0.1*x+1.6*y; dr = dr-3.6*x+0.3*y; db = db-0.2*x+0.6*y;
714 
715  l = p2 * frac(0.2561136+m6/p2+((5018.6+t*1.9)*t+dl)/1296.0e3);
716  b = (175.1 - 10.2*t + db) / arc;
717  r = 9.557584 - 0.000186*t + dr*1.0e-5;
718 
719  dl = 5.84+0.65*cos(m6); dr = 3.09*sin(m6); db = 0.24*cos(m6);
720 
721  posvel();
722 
723  return rp;
724  }
725 
726 
727 /*--------------------- Uranus ------------------------------------------*/
728 
729 Vec3 Plan200::Uranus (double t) // position of Uranus at time t
730  {
731  /*
732  Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day)
733  of Uranus for Equinox of Date.
734  t is the time in Julian centuries since J2000.
735  */
736 
737  const double arc = 206264.81; // 3600*180/pi = ''/r
738  const double p2 = M_PI * 2.0;
739 
740  int i;
741 
742  tt = t;
743  dl = 0.0; dr = 0.0; db = 0.0;
744  m5 = p2 * frac(0.0564472+8.4302889*t);
745  m6 = p2 * frac(0.8829611+3.3947583*t);
746  m7 = p2 * frac(0.3967117+1.1902849*t);
747  m8 = p2 * frac(0.7216833+0.6068528*t);
748  c3[2] = 1.0; s3[2] = 0.0; c3[3] = cos(m7); s3[3] = sin(m7);
749  for (i=4; i<10; i++)
750  addthe(c3[i-1],s3[i-1],c3[3],s3[3],c3[i],s3[i]);
751  c3[1] = c3[3];
752  s3[1] = -s3[3];
753  c3[0] = c3[4];
754  s3[0] = -s3[4];
755 
756  // perturbations by Jupiter
757  c[8] = 1.0; s[8] = 0.0; c[7] = cos(m5); s[7] = -sin(m5);
758  addthe(c[7],s[7],c[7],s[7],c[6],s[6]);
759  term(1, 7, 0, 0.0, 0.0, -0.1, 1.7, -0.1, 0.0);
760  term(2, 7, 0, 0.5, -1.2, 18.9, 9.1, -0.9, 0.1);
761  term(3, 7, 0, -21.2, 48.7, -455.5, -198.8, 0.0, 0.0);
762  term(3, 6, 0, -0.5, 1.2, -10.9, -4.8, 0.0, 0.0);
763  term(4, 7, 0, -1.3, 3.2, -23.2, -11.1, 0.3, 0.1);
764  term(4, 6, 0, -0.2, 0.2, 1.1, 1.5, 0.0, 0.0);
765  term(5, 7, 0, 0.0, 0.2, -1.8, 0.4, 0.0, 0.0);
766 
767  // perturbations by Saturn
768  c[7] = cos(m6); s[7] = -sin(m6);
769  for (i=7; i>4; i--)
770  addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]);
771  term(2, 7, 0, 1.4, -0.5, -6.4, 9.0, -0.4, -0.8);
772  term(3, 7, 0, -18.6, -12.6, 36.7, -336.8, 1.0, 0.3);
773  term(3, 6, 0, -0.7, -0.3, 0.5, -7.5, 0.1, 0.0);
774  term(4, 7, 0, 20.0, -141.6, -587.1, -107.0, 3.1, -0.8);
775  term(4, 7, 1, 1.0, 1.4, 5.8, -4.0, 0.0, 0.0);
776  term(4, 6, 0, 1.6, -3.8, -35.6, -16.0, 0.0, 0.0);
777  term(5, 7, 0, 75.3, -100.9, 128.9, 77.5, -0.8, 0.1);
778  term(5, 7, 1, 0.2, 1.8, -1.9, 0.3, 0.0, 0.0);
779  term(5, 6, 0, 2.3, -1.3, -9.5, -17.9, 0.0, 0.1);
780  term(5, 5, 0, -0.7, -0.5, -4.9, 6.8, 0.0, 0.0);
781  term(6, 7, 0, 3.4, -5.0, 21.6, 14.3, -0.8, -0.5);
782  term(6, 6, 0, 1.9, 0.1, 1.2, -12.1, 0.0, 0.0);
783  term(6, 5, 0, -0.1, -0.4, -3.9, 1.2, 0.0, 0.0);
784  term(6, 4, 0, -0.2, 0.1, 1.6, 1.8, 0.0, 0.0);
785  term(7, 7, 0, 0.2, -0.3, 1.0, 0.6, -0.1, 0.0);
786  term(7, 6, 0, -2.2, -2.2, -7.7, 8.5, 0.0, 0.0);
787  term(7, 5, 0, 0.1, -0.2, -1.4, -0.4, 0.0, 0.0);
788  term(7, 4, 0, -0.1, 0.0, 0.1, 1.2, 0.0, 0.0);
789  term(8, 6, 0, -0.2, -0.6, 1.4, -0.7, 0.0, 0.0);
790 
791  // perturbations by Neptune
792  c[7] = cos(m8); s[7] = -sin(m8);
793  for (i=7; i>0; i--)
794  addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]);
795  term(3, 8, 0, -78.1, 19518.1, -90718.2, -334.7, 2759.5, -311.9);
796  term(3, 8, 1, -81.6, 107.7, -497.4, -379.5, -2.8, -43.7);
797  term(3, 8, 2, -6.6, -3.1, 14.4, -30.6, -0.4, -0.5);
798  term(3, 8, 3, 0.0, -0.5, 2.4, 0.0, 0.0, 0.0);
799  term(4, 8, 0, -2.4, 586.1, -2145.2, -15.3, 130.6, -14.3);
800  term(4, 8, 1, -4.5, 6.6, -24.2, -17.8, 0.7, -1.6);
801  term(4, 8, 2, -0.4, 0.0, 0.1, -1.4, 0.0, 0.0);
802  term(5, 8, 0, 0.0, 24.5, -76.2, -0.6, 7.0, -0.7);
803  term(5, 8, 1, -0.2, 0.4, -1.4, -0.8, 0.1, -0.1);
804  term(6, 8, 0, 0.0, 1.1, -3.0, 0.1, 0.4, 0.0);
805  term(1, 7, 0, -0.2, 0.2, 0.7, 0.7, -0.1, 0.0);
806  term(2, 7, 0, -2.8, 2.5, 8.7, 10.5, -0.4, -0.1);
807  term(3, 7, 0, -28.4, 20.3, -51.4, -72.0, 0.0, 0.0);
808  term(3, 6, 0, -0.6, -0.1, 4.2, -14.6, 0.2, 0.4);
809  term(3, 5, 0, 0.2, 0.5, 3.4, -1.6, -0.1, 0.1);
810  term(4, 7, 0, -1.8, 1.3, -5.5, -7.7, 0.0, 0.3);
811  term(4, 6, 0, 29.4, 10.2, -29.0, 83.2, 0.0, 0.0);
812  term(4, 5, 0, 8.8, 17.8, -41.9, 21.5, -0.1, -0.3);
813  term(4, 4, 0, 0.0, 0.1, -2.1, -0.9, 0.1, 0.0);
814  term(5, 6, 0, 1.5, 0.5, -1.7, 5.1, 0.1, -0.2);
815  term(5, 5, 0, 4.4, 14.6, -84.3, 25.2, 0.1, -0.1);
816  term(5, 4, 0, 2.4, -4.5, 12.0, 6.2, 0.0, 0.0);
817  term(5, 3, 0, 2.9, -0.9, 2.1, 6.2, 0.0, 0.0);
818  term(6, 5, 0, 0.3, 1.0, -4.0, 1.1, 0.1, -0.1);
819  term(6, 4, 0, 2.1, -2.7, 17.9, 14.0, 0.0, 0.0);
820  term(6, 3, 0, 3.0, -0.4, 2.3, 17.6, -0.1, -0.1);
821  term(6, 2, 0, -0.6, -0.5, 1.1, -1.6, 0.0, 0.0);
822  term(7, 4, 0, 0.2, -0.2, 1.0, 0.8, 0.0, 0.0);
823  term(7, 3, 0, -0.9, -0.1, 0.6, -7.1, 0.0, 0.0);
824  term(7, 2, 0, -0.5, -0.6, 3.8, -3.6, 0.0, 0.0);
825  term(7, 1, 0, 0.0, -0.5, 3.0, 0.1, 0.0, 0.0);
826  term(8, 2, 0, 0.2, 0.3, -2.7, 1.6, 0.0, 0.0);
827  term(8, 1, 0, -0.1, 0.2, -2.0, -0.4, 0.0, 0.0);
828  term(9, 1, 0, 0.1, -0.2, 1.3, 0.5, 0.0, 0.0);
829  term(9, 0, 0, 0.1, 0.0, 0.4, 0.9, 0.0, 0.0);
830 
831  // perturbations by Jupiter and Saturn
832  c[7] = cos(m6); s[7] = -sin(m6);
833  c[4] = cos(-4*m6+2*m5); s[4] = sin(-4*m6+2*m5);
834  for (i=4; i>2; i--)
835  addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]);
836  term(0, 4, 0, -0.7, 0.4, -1.5, -2.5, 0.0, 0.0);
837  term(1, 4, 0, -0.1, -0.1, -2.2, 1.0, 0.0, 0.0);
838  term(3, 3, 0, 0.1, -0.4, 1.4, 0.2, 0.0, 0.0);
839  term(3, 2, 0, 0.4, 0.5, -0.8, -0.8, 0.0, 0.0);
840  term(4, 2, 0, 5.7, 6.3, 28.5, -25.5, 0.0, 0.0);
841  term(4, 2, 1, 0.1, -0.2, -1.1, -0.6, 0.0, 0.0);
842  term(5, 2, 0, -1.4, 29.2, -11.4, 1.1, 0.0, 0.0);
843  term(5, 2, 1, 0.8, -0.4, 0.2, 0.3, 0.0, 0.0);
844  term(6, 2, 0, 0.0, 1.3, -6.0, -0.1, 0.0, 0.0);
845 
846  l = p2 * frac(0.4734843+m7/p2+((5082.3+34.2*t)*t+dl)/1296.0E3);
847  b = (-130.61+(-0.54+0.04*t)*t+db)/arc;
848  r = 19.211991+(-0.000333-0.000005*t)*t+dr*1.0e-5;
849 
850  dl = 2.05+0.19*cos(m7); dr = 1.86*sin(m7); db = -0.03*sin(m7);
851 
852  posvel();
853 
854  return rp;
855  }
856 
857 
858 /*--------------------- Neptune ------------------------------------------*/
859 
860 Vec3 Plan200::Neptune (double t) // position of Neptune at time t
861  {
862  /*
863  Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day)
864  of Neptune for Equinox of Date.
865  t is the time in Julian centuries since J2000.
866  */
867 
868  const double arc = 206264.81; // 3600*180/pi = ''/r
869  const double p2 = M_PI * 2.0;
870 
871  int i;
872 
873  tt = t;
874  dl = 0.0; dr = 0.0; db = 0.0;
875  m5 = p2 * frac(0.0563867+8.4298907*t);
876  m6 = p2 * frac(0.8825086+3.3957748*t);
877  m7 = p2 * frac(0.3965358+1.1902851*t);
878  m8 = p2 * frac(0.7214906+0.6068526*t);
879  c3[0] = 1.0; s3[0] = 0.0; c3[1] = cos(m8); s3[1] = sin(m8);
880  for (i=2; i<7; i++)
881  addthe(c3[i-1],s3[i-1],c3[1],s3[1],c3[i],s3[i]);
882 
883  // perturbations by Jupiter
884  c[6] = 1.0; s[6] = 0.0; c[5] = cos(m5); s[5] = -sin(m5);
885  addthe(c[5],s[5],c[5],s[5],c[4],s[4]);
886  term(0, 5, 0, 0.1, 0.1, -3.0, 1.8, -0.3, -0.3);
887  term(1, 6, 0, 0.0, 0.0, -15.9, 9.0, 0.0, 0.0);
888  term(1, 5, 0, -17.6, -29.3, 416.1, -250.0, 0.0, 0.0);
889  term(1, 4, 0, -0.4, -0.7, 10.4, -6.2, 0.0, 0.0);
890  term(2, 5, 0, -0.2, -0.4, 2.4, -1.4, 0.4, -0.3);
891 
892  // perturbations by Saturn
893  c[6] = 1.0; s[6] = 0.0; c[5] = cos(m6); s[5] = -sin(m6);
894  addthe(c[5],s[5],c[5],s[5],c[4],s[4]);
895  term(0, 5, 0, -0.1, 0.0, 0.2, -1.8, -0.1, -0.5);
896  term(1, 6, 0, 0.0, 0.0, -8.3, -10.4, 0.0, 0.0);
897  term(1, 5, 0, 13.6, -12.7, 187.5, 201.1, 0.0, 0.0);
898  term(1, 4, 0, 0.4, -0.4, 4.5, 4.5, 0.0, 0.0);
899  term(2, 5, 0, 0.4, -0.1, 1.7, -3.2, 0.2, 0.2);
900  term(2, 4, 0, -0.1, 0.0, -0.2, 2.7, 0.0, 0.0);
901 
902  // perturbations by Uranus
903  c[6] = 1.0; s[6] = 0.0; c[5] = cos(m7); s[5] = -sin(m7);
904  for (i=5; i>0; i--)
905  addthe(c[i],s[i],c[5],s[5],c[i-1],s[i-1]);
906  term(1, 6, 0, 32.3, 3549.5, -25880.2, 235.8, -6360.5, 374.0);
907  term(1, 6, 1, 31.2, 34.4, -251.4, 227.4, 34.9, 29.3);
908  term(1, 6, 2, -1.4, 3.9, -28.6, -10.1, 0.0, -0.9);
909  term(2, 6, 0, 6.1, 68.0, -111.4, 2.0, -54.7, 3.7);
910  term(2, 6, 1, 0.8, -0.2, -2.1, 2.0, -0.2, 0.8);
911  term(3, 6, 0, 0.1, 1.0, -0.7, 0.0, -0.8, 0.1);
912  term(0, 5, 0, -0.1, -0.3, -3.6, 0.0, 0.0, 0.0);
913  term(1, 6, 0, 0.0, 0.0, 5.5, -6.9, 0.1, 0.0);
914  term(1, 5, 0, -2.2, -1.6, -116.3, 163.6, 0.0, -0.1);
915  term(1, 4, 0, 0.2, 0.1, -1.2, 0.4, 0.0, -0.1);
916  term(2, 5, 0, 4.2, -1.1, -4.4, -34.6, -0.2, 0.1);
917  term(2, 4, 0, 8.6, -2.9, -33.4, -97.0, 0.2, 0.1);
918  term(3, 5, 0, 0.1, -0.2, 2.1, -1.2, 0.0, 0.1);
919  term(3, 4, 0, -4.6, 9.3, 38.2, 19.8, 0.1, 0.1);
920  term(3, 3, 0, -0.5, 1.7, 23.5, 7.0, 0.0, 0.0);
921  term(4, 4, 0, 0.2, 0.8, 3.3, -1.5, -0.2, -0.1);
922  term(4, 3, 0, 0.9, 1.7, 17.9, -9.1, -0.1, 0.0);
923  term(4, 2, 0, -0.4, -0.4, -6.2, 4.8, 0.0, 0.0);
924  term(5, 3, 0, -1.6, -0.5, -2.2, 7.0, 0.0, 0.0);
925  term(5, 2, 0, -0.4, -0.1, -0.7, 5.5, 0.0, 0.0);
926  term(5, 1, 0, 0.2, 0.0, 0.0, -3.5, 0.0, 0.0);
927  term(6, 2, 0, -0.3, 0.2, 2.1, 2.7, 0.0, 0.0);
928  term(6, 1, 0, 0.1, -0.1, -1.4, -1.4, 0.0, 0.0);
929  term(6, 0, 0, -0.1, 0.1, 1.4, 0.7, 0.0, 0.0);
930 
931  l = p2 * frac(0.1254046+m8/p2+((4982.8-21.3*t)*t+dl)/1296.0e3);
932  b = (54.77+(0.26+0.06*t)*t+db)/arc;
933  r = 30.072984+(0.001234+0.000003*t)*t+dr*1.0e-5;
934 
935  dl = 1.04+0.02*cos(m8); dr = 0.27*sin(m8); db = 0.03*sin(m8);
936 
937  posvel();
938 
939  return rp;
940  }
941 
942 /*--------------------- Pluto ------------------------------------------*/
943 
944 Vec3 Plan200::Pluto (double t) // position of Pluto at time t
945  {
946  /*
947  Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day)
948  of Pluto for Equinox of Date.
949  t is the time in Julian centuries since J2000.
950  */
951 
952  const double arc = 206264.81; // 3600*180/pi = ''/r
953  const double p2 = M_PI * 2.0;
954 
955  int i;
956 
957  tt = t;
958  dl = 0.0; dr = 0.0; db = 0.0;
959  m5 = p2 * frac(0.0565314+8.4302963*t);
960  m6 = p2 * frac(0.8829867+3.3947688*t);
961  m1 = p2 * frac(0.0385795+0.4026667*t);
962  c3[0] = 1.0; s3[0] = 0.0; c3[1] = cos(m1); s3[1] = sin(m1);
963  for (i=2; i<7; i++)
964  addthe(c3[i-1],s3[i-1],c3[1],s3[1],c3[i],s3[i]);
965 
966  // Kepler terms and perturbations by Jupiter
967  c[3] = 1.0; s[3] = 0.0; c[4] = cos(m5); s[4] = sin(m5);
968  for (i=3; i>1; i--)
969  addthe(c[i],s[i],c[4],-s[4],c[i-1],s[i-1]);
970  addthe(c[4],s[4],c[4],s[4],c[5],s[5]);
971  term(1, 3, 0, 0.06,100924.08, -960396.0,15965.1, 51987.68,-24288.76);
972  term(2, 3, 0, 3274.74,17835.12, -118252.2,3632.4, 12687.49,-6049.72);
973  term(3, 3, 0, 1543.52,4631.99, -21446.6,1167.0, 3504.0,-1853.1);
974  term(4, 3, 0, 688.99,1227.08, -4823.4,213.5, 1048.19,-648.26);
975  term(5, 3, 0, 242.27, 415.93, -1075.4, 140.6, 302.33, -209.76);
976  term(6, 3, 0, 138.41, 110.91, -308.8, -55.3, 109.52, -93.82);
977  term(3, 2, 0, -0.99, 5.06, -25.6, 19.8, 1.26, -1.96);
978  term(2, 2, 0, 7.15, 5.61, -96.7, 57.2, 1.64, -2.16);
979  term(1, 2, 0, 10.79, 23.13, -390.4, 236.4, -0.33, 0.86);
980  term(0, 4, 0, -0.23, 4.43, 102.8, 63.2, 3.15, 0.34);
981  term(1, 4, 0, -1.1, -0.92, 11.8, -2.3, 0.43, 0.14);
982  term(2, 4, 0, 0.62, 0.84, 2.3, 0.7, 0.05, -0.04);
983  term(3, 4, 0, -0.38, -0.45, 1.2, -0.8, 0.04, 0.05);
984  term(4, 4, 0, 0.17, 0.25, 0.0, 0.2, -0.01, -0.01);
985  term(3, 1, 0, 0.06, 0.07, -0.6, 0.3, 0.03, -0.03);
986  term(2, 1, 0, 0.13, 0.2, -2.2, 1.5, 0.03, -0.07);
987  term(1, 1, 0, 0.32, 0.49, -9.4, 5.7, -0.01, 0.03);
988  term(0, 1, 0, -0.04, -0.07, 2.6, -1.5, 0.07, -0.02);
989 
990  // perturbations by Saturn
991  c[4] = cos(m6); s[4] = sin(m6);
992  for (i=3; i>1; i--)
993  addthe(c[i],s[i],c[4],-s[4],c[i-1],s[i-1]);
994  term(1, 2, 0, -29.47, 75.97, -106.4, -204.9, -40.71, -17.55);
995  term(0, 4, 0, -13.88, 18.2, 42.6, -46.1, 1.13, 0.43);
996  term(1, 4, 0, 5.81, -23.48, 15.0, -6.8, -7.48, 3.07);
997  term(2, 4, 0, -10.27, 14.16, -7.9, 0.4, 2.43, -0.09);
998  term(3, 4, 0, 6.86, -10.66, 7.3, -0.3, -2.25, 0.69);
999  term(2, 1, 0, 4.23, 2.0, 0.0, -2.2, -0.24, 0.12);
1000  term(1, 1, 0, -5.04, -0.83, -9.2, -3.1, 0.79, -0.24);
1001  term(0, 1, 0, 4.25, 2.48, -5.9, -3.3, 0.58, 0.02);
1002 
1003  // perturbations by Jupiter and Saturn
1004  double x, y;
1005  y = (m5-m6); x = cos(y); y = sin(y);
1006  dl = dl-9.11*x+0.12*y; dr = dr-3.4*x-3.3*y; db = db+0.81*x+0.78*y;
1007  addthe(x,y,c3[1],s3[1],x,y);
1008  dl = dl+5.92*x+0.25*y; dr = dr+2.3*x-3.8*y; db = db-0.67*x-0.51*y;
1009 
1010  l = p2 * frac(0.6232469+m1/p2+dl/1296.0e3);
1011  b = -6.8232495189e-2 + db/arc;
1012  r = 40.7247248+dr*1.0e-5;
1013 
1014  dl = 0.69+0.34*cos(m1)+0.12*cos(2*m1)+0.05*cos(3*m1);
1015  dr = 6.66*sin(m1)+1.64*sin(2*m1);
1016  db = -0.08*cos(m1)-0.17*sin(m1)-0.09*sin(2*m1);
1017 
1018  // position
1019  double cl, sl, cb, sb;
1020  Mat3 mx;
1021 
1022  cl = cos(l); sl = sin(l); cb = cos(b); sb = sin(b);
1023  rp[0] = r*cl*cb; rp[1] = r*sl*cb; rp[2] = r*sb;
1024  mx = pmatecl (-0.5000021, t); // 1950.0 -> Equinox of Date
1025  rp = mxvct (mx, rp);
1026 
1027  // velocity
1028  vp[0] = (dr*cl*cb - dl*r*sl*cb - db*r*cl*sb) * 1E-4;
1029  vp[1] = (dr*sl*cb + dl*r*cl*cb - db*r*sl*sb) * 1E-4;
1030  vp[2] = (dr*sb + db*r*cb) * 1E-4;
1031 
1032  return rp;
1033  }
1034 
1035 /***************************************************************************/
1036 /* =========================================================================
1037  Procedures for calculating the positions of various moons in the
1038  solar system. The algorithms for the procedures of this unit are
1039  taken from the Explanatory Supplement to the Astronomical Almanac
1040  (edited by Kenneth Seidelmann, University Science Books, Mill Valley,
1041  California, 1992. A number of errors in chapter 6 of this book have
1042  been identified and corrected in the code used here.
1043 
1044  Copyright :Gerhard HOLTKAMP 21-MAY-2000 18:00
1045  ========================================================================= */
1046 
1047 
1048 /*--------------------- MarPhobos -----------------------------------------*/
1049 void MarPhobos (double t, Vec3& rs, Vec3& vs)
1050  {
1051  /*
1052  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1053  of the Mars moon Phobos with respect to Mars for Equinox of Date.
1054  t is the time in Julian centuries since J2000.
1055  ====================================================================*/
1056 
1057  const double p2 = M_PI * 2.0;
1058  const double ax =6.26974E-5;
1059  const double nm = 1128.844556;
1060  const double ee = 0.0150;
1061  const double gam = 1.10*M_PI/180.0;
1062 
1063  double thet, ll, pp, na, ja;
1064  double al, dy, yr;
1065  Mat3 mt1;
1066 
1067  // time from 11-NOV-1971
1068  dy = t * 36525.0 + 10278.5;
1069  yr = dy / 365.25;
1070 
1071  // normalized angles
1072  thet = p2 * frac ((327.9 - 0.43533*dy) / 360.0);
1073  ll = p2 * frac ((232.41 + nm*dy + 0.00124*yr*yr) / 360.0);
1074  pp = p2 * frac ((278.96 + 0.43526*dy) / 360.0);
1075  na = p2 * frac ((47.39 - 0.0014*yr) / 360.0);
1076  ja = p2 * frac ((37.27 + 0.0008*yr) / 360.0);
1077 
1078  // in-orbit-plane position vector
1079  al = ll - pp; // mean anomaly
1080  al = eccanom (al, ee); // eccentric anomaly
1081  rs[0] = ax * (cos(al) - ee);
1082  rs[1] = ax * sqrt(1.0 - ee*ee) * sin(al);
1083  rs[2] = 0.0;
1084 
1085  // in-orbit-plane velocity vector
1086  dy = cos(al);
1087  yr = 1.0 - ee*dy;
1088  yr = 1.235083014E-3 / yr;
1089  vs.assign(-yr*sin(al),yr*sqrt(1.0-ee*ee)*dy,0.0);
1090 
1091  // convert to equatorial coordinates
1092  al = pp - thet - na;
1093  mt1 = zrot (-al);
1094  rs = mxvct (mt1, rs);
1095  vs = mxvct (mt1, vs);
1096  mt1 = xrot (-gam);
1097  rs = mxvct (mt1, rs);
1098  vs = mxvct (mt1, vs);
1099  mt1 = zrot (-thet);
1100  rs = mxvct (mt1, rs);
1101  vs = mxvct (mt1, vs);
1102  mt1 = xrot (-ja);
1103  rs = mxvct (mt1, rs);
1104  vs = mxvct (mt1, vs);
1105  mt1 = zrot (-na);
1106  rs = mxvct (mt1, rs);
1107  vs = mxvct (mt1, vs);
1108 
1109  // convert to ecliptic coordinates of date
1110  mt1 = pmatequ (-0.500002096, t);
1111  rs = mxvct (mt1, rs);
1112  vs = mxvct (mt1, vs);
1113  rs = equecl (t, rs);
1114  vs = equecl (t, vs);
1115 
1116  }
1117 
1118 /*--------------------- MarDeimos ------------------------------------------*/
1119 void MarDeimos (double t, Vec3& rs, Vec3& vs)
1120  {
1121  /*
1122  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1123  of the Mars moon Deimos with respect to Mars for Equinox of Date.
1124  t is the time in Julian centuries since J2000.
1125  ====================================================================== */
1126 
1127  const double p2 = M_PI * 2.0;
1128  const double ax =1.56828E-4;
1129  const double nm = 285.161888;
1130  const double ee = 0.0004;
1131  const double gam = 1.79*M_PI/180.0;
1132 
1133  double thet, ll, pp, na, ja;
1134  double al, dy, yr;
1135  Mat3 mt1;
1136 
1137  // time from 11-NOV-1971
1138  dy = t * 36525.0 + 10278.5;
1139  yr = dy / 365.25;
1140 
1141  // normalized angles
1142  thet = p2 * frac ((240.38 - 0.01801*dy) / 360.0);
1143  ll = p2 * frac ((196.55 - 0.01801*dy) / 360.0);
1144  ll = p2 * frac ((28.96 + nm*dy - 0.27*sin(ll)) / 360.0);
1145  pp = p2 * frac ((111.7 + 0.01798*dy) / 360.0);
1146  na = p2 * frac ((46.37 - 0.0014*yr) / 360.0);
1147  ja = p2 * frac ((36.62 + 0.0008*yr) / 360.0);
1148 
1149  // in-orbit- plane position vector
1150  al = ll - pp; // mean anomaly
1151  al = eccanom (al, ee); // eccentric anomaly
1152  rs[0] = ax * (cos(al) - ee);
1153  rs[1] = ax * sqrt(1.0 - ee*ee) * sin(al);
1154  rs[2] = 0.0;
1155 
1156  // in-orbit-plane velocity vector
1157  dy = cos(al);
1158  yr = 1.0 - ee*dy;
1159  yr = 7.8046400669E-4 / yr;
1160  vs.assign(-yr*sin(al),yr*sqrt(1.0-ee*ee)*dy,0.0);
1161 
1162  // convert to equatorial coordinates
1163  al = pp - thet - na;
1164  mt1 = zrot (-al);
1165  rs = mxvct (mt1, rs);
1166  vs = mxvct (mt1, vs);
1167  mt1 = xrot (-gam);
1168  rs = mxvct (mt1, rs);
1169  vs = mxvct (mt1, vs);
1170  mt1 = zrot (-thet);
1171  rs = mxvct (mt1, rs);
1172  vs = mxvct (mt1, vs);
1173  mt1 = xrot (-ja);
1174  rs = mxvct (mt1, rs);
1175  vs = mxvct (mt1, vs);
1176  mt1 = zrot (-na);
1177  rs = mxvct (mt1, rs);
1178  vs = mxvct (mt1, vs);
1179 
1180  // convert to ecliptic coordinates of date
1181  mt1 = pmatequ (-0.500002096, t);
1182  rs = mxvct (mt1, rs);
1183  vs = mxvct (mt1, vs);
1184  rs = equecl (t, rs);
1185  vs = equecl (t, vs);
1186 
1187  }
1188 
1189 /*--------------------- PosJIo ------------------------------------------*/
1190 Vec3 PosJIo (double t)
1191  {
1192  /* ---------------------------------------------------------------------- }
1193  Ecliptic coordinates (in A.U.) rs
1194  of Io with respect to Jupiter for Equinox of Date.
1195  t is the time in Julian centuries since J2000.
1196  ======================================================================*/
1197 
1198  const double pi2 = M_PI * 2.0;
1199  const double ax = 0.002819347;
1200  const double omj = 99.99754*M_PI/180.0;
1201  const double jj = 1.30691*M_PI/180.0;
1202  const double ii = 3.10401*M_PI/180.0;
1203 
1204  double l1, l2, phl, p1, p2, p3, p4;
1205  double pij, th1, th2, psi, gg;
1206  double xi, nu, ze;
1207  double d; // : EXTENDED;
1208  Vec3 rs;
1209  Mat3 mt1;
1210 
1211  // general jupiter moon data
1212  d = t*36525.0 + 8544.5;
1213  l1 = pi2 * frac((106.07859 + 203.4889553630643*d)/360.0);
1214  l2 = pi2 * frac((175.733787 + 101.3747245566245*d)/360.0);
1215  phl = pi2* frac((184.415351 + 0.17356902*d)/360.0);
1216  p1 = pi2 * frac((82.380231 + 0.16102275*d)/360.0);
1217  p2 = pi2 * frac((128.960393 + 0.04645644*d)/360.0);
1218  p3 = pi2 * frac((187.550171 + 0.00712408*d)/360.0);
1219  p4 = pi2 * frac((335.309254 + 0.00183939*d)/360.0);
1220  pij = 0.23510274429; // 13.470395
1221  th1 = pi2* frac((308.365749 - 0.1328061*d)/360.0);
1222  th2 = pi2* frac((100.438938 - 0.03261535*d)/360.0);
1223  psi = pi2* frac((316.500101 - 0.00000248*d)/360.0);
1224  gg = pi2 * frac((30.2380210168 + 0.08309256178969453*d)/360.0);
1225 
1226  // io specific lines
1227  xi = -41279.0 * cos(2.0*(l1-l2))*1E-7;
1228  nu = -5596.0*sin(p3-p4) - 2198.0*sin(p1+p2-2.0*(pij+gg))
1229  +1321.0*sin(phl) - 1157.0*sin(l1-2.0*l2+p4)
1230  -1940.0*sin(l1-2.0*l2+p3) + 791.0*sin(l1-2.0*l2+p2)
1231  + 82363.0*sin(2.0*(l1-l2));
1232  nu *= 1E-7;
1233  ze = 7038.0*sin(l1-th1+nu) + 1835.0*sin(l1-th2+nu);
1234  ze *= 1E-7;
1235 
1236  // convert to rectangular coordinates in Jovian equatorial
1237 
1238  rs.assign (ax * (1+xi) * cos(l1-psi+nu),
1239  ax * (1+xi) * sin(l1-psi+nu),
1240  ax * ze);
1241 
1242  // convert into ecliptic of 1950.0
1243  mt1 = xrot (-ii);
1244  rs = mxvct (mt1, rs);
1245  mt1 = zrot (-(psi-omj));
1246  rs = mxvct (mt1, rs);
1247  mt1 = xrot (-jj);
1248  rs = mxvct (mt1, rs);
1249  mt1 = zrot (-omj);
1250  rs = mxvct (mt1, rs);
1251 
1252  // convert into ecliptic of date
1253  mt1 = pmatecl (-0.500002096, t);
1254  rs = mxvct (mt1, rs);
1255 
1256  return rs;
1257 
1258  }
1259 
1260 /*--------------------- PosEuropa ------------------------------------------*/
1261 Vec3 PosEuropa (double t)
1262  {
1263  /*
1264  Ecliptic coordinates (in A.U.) rs
1265  of Europa with respect to Jupiter for Equinox of Date.
1266  t is the time in Julian centuries since J2000.
1267  =====================================================================*/
1268 
1269  const double pi2 = M_PI * 2.0;
1270  const double ax = 0.004485872;
1271  const double omj = 99.99754*M_PI/180.0;
1272  const double jj = 1.30691*M_PI/180.0;
1273  const double ii = 3.10401*M_PI/180.0;
1274 
1275  double l1, l2, l3, phl, p2, p3, p4;
1276  double pij, th2, th3, psi, gg;
1277  double xi, nu, ze;
1278  double d; // : EXTENDED;
1279  Vec3 rs;
1280  Mat3 mt1;
1281 
1282 
1283  // general jupiter moon data
1284  d = t*36525.0 + 8544.5;
1285  l1 = pi2 * frac((106.07859 + 203.4889553630643*d)/360.0);
1286  l2 = pi2 * frac((175.733787 + 101.3747245566245*d)/360.0);
1287  l3 = pi2 * frac((120.5613855 + 50.31760915340462*d)/360.0);
1288  phl = pi2* frac((184.415351 + 0.17356902*d)/360.0);
1289  // p1 = pi2 * frac((82.380231 + 0.16102275*d)/360.0);
1290  p2 = pi2 * frac((128.960393 + 0.04645644*d)/360.0);
1291  p3 = pi2 * frac((187.550171 + 0.00712408*d)/360.0);
1292  p4 = pi2 * frac((335.309254 + 0.00183939*d)/360.0);
1293  pij = 0.23510274429; // 13.470395
1294  th2 = pi2* frac((100.438938 - 0.03261535*d)/360.0);
1295  th3 = pi2* frac((118.908928 - 0.00717678*d)/360.0);
1296  psi = pi2* frac((316.500101 - 0.00000248*d)/360.0);
1297  gg = pi2 * frac((30.2380210168 + 0.08309256178969453*d)/360.0);
1298 
1299  // Europa specific lines
1300  xi = -3187*cos(l2-p3) - 1738*cos(l2-p4)
1301  +93748*cos(l1-l2);
1302  xi *= 1E-7;
1303  nu = -1158*sin(2*(psi-pij)) + 1715*sin(-2*(pij+gg)+th3+psi)
1304  -1846*sin(gg) + 2397*sin(p3-p4) - 3172*sin(phl)
1305  -1993*sin(l2-l3) + 1844*sin(l2-p2)
1306  +6394*sin(l2-p3) + 3451*sin(l2-p4)
1307  +4159*sin(l1-2*l2+p4) + 7571*sin(l1-2*l2+p3)
1308  -1491*sin(l1-2*l2+p3) - 185640*sin(l1-l2)
1309  -803*sin(l1-l3) + 915*sin(2*(l1-l2));
1310  nu *= 1E-7;
1311  ze = 81575*sin(l2-th2+nu) + 4512*sin(l2-th3+nu)
1312  -3286*sin(l2-psi+nu);
1313  ze *= 1E-7;
1314 
1315  // convert to rectangular coordinates in Jovian equatorial
1316 
1317  rs.assign (ax * (1+xi) * cos(l2-psi+nu),
1318  ax * (1+xi) * sin(l2-psi+nu),
1319  ax * ze);
1320 
1321  // convert into ecliptic of 1950.0
1322 
1323  mt1 = xrot (-ii);
1324  rs = mxvct (mt1, rs);
1325  mt1 = zrot (-(psi-omj));
1326  rs = mxvct (mt1, rs);
1327  mt1 = xrot (-jj);
1328  rs = mxvct (mt1, rs);
1329  mt1 = zrot (-omj);
1330  rs = mxvct (mt1, rs);
1331 
1332  // convert into ecliptic of date
1333  mt1 = pmatecl (-0.500002096, t);
1334  rs = mxvct (mt1, rs);
1335 
1336  return rs;
1337 
1338  }
1339 
1340 /*--------------------- PosGanymede --------------------------------------*/
1341 Vec3 PosGanymede (double t)
1342  {
1343  /*
1344  Ecliptic coordinates (in A.U.)
1345  of Ganymede with respect to Jupiter for Equinox of Date.
1346  t is the time in Julian centuries since J2000.
1347  =====================================================================*/
1348 
1349  const double pi2 = M_PI * 2.0;
1350  const double ax = 0.007155352;
1351  const double omj = 99.99754*M_PI/180.0;
1352  const double jj = 1.30691*M_PI/180.0;
1353  const double ii = 3.10401*M_PI/180.0;
1354 
1355  double l1, l2, l3, l4, phl, p1, p2, p3, p4;
1356  double pij, th2, th3, th4, psi, gg;
1357  double xi, nu, ze;
1358  double d; // : EXTENDED;
1359  Vec3 rs;
1360  Mat3 mt1;
1361 
1362  // general jupiter moon data
1363  d = t*36525.0 + 8544.5;
1364  l1 = pi2 * frac((106.07859 + 203.4889553630643*d)/360.0);
1365  l2 = pi2 * frac((175.733787 + 101.3747245566245*d)/360.0);
1366  l3 = pi2 * frac((120.5613855 + 50.31760915340462*d)/360.0);
1367  l4 = pi2 * frac((84.455823 + 21.57107087517961*d)/360.0);
1368  phl = pi2* frac((184.415351 + 0.17356902*d)/360.0);
1369  p1 = pi2 * frac((82.380231 + 0.16102275*d)/360.0);
1370  p2 = pi2 * frac((128.960393 + 0.04645644*d)/360.0);
1371  p3 = pi2 * frac((187.550171 + 0.00712408*d)/360.0);
1372  p4 = pi2 * frac((335.309254 + 0.00183939*d)/360.0);
1373  pij = 0.23510274429; // 13.470395
1374  th2 = pi2* frac((100.438938 - 0.03261535*d)/360.0);
1375  th3 = pi2* frac((118.908928 - 0.00717678*d)/360.0);
1376  th4 = pi2* frac((322.746564 - 0.00176018*d)/360.0);
1377  psi = pi2* frac((316.500101 - 0.00000248*d)/360.0);
1378  gg = pi2 * frac((30.2380210168 + 0.08309256178969453*d)/360.0);
1379 
1380  // Ganymede specific lines
1381  xi = -14691*cos(l3-p3) - 1758*cos(2*(l3-l4))
1382  +6333*cos(l2-l3);
1383  xi *= 1E-7;
1384  nu = -1488*sin(2*(pij+psi)) + 411*sin(-th3+psi)
1385  +346*sin(-th4+psi) - 2338*sin(gg)
1386  +6558*sin(p3-p4) + 523*sin(p1+p3-2*(pij+gg))
1387  +341*sin(phl) - 943*sin(l3-l4)
1388  +29387*sin(l3-p3) + 15800*sin(l3-p4)
1389  +3218*sin(2*(l3-l4)) + 226*sin(3*l3-2*l4)
1390  -12038*sin(l2-l3) - 662*sin(l1-2*l2+p4)
1391  -1246*sin(l1-2*l2+p3) + 699*sin(l1-2*l2+p2)
1392  +217*sin(l1-l3);
1393  nu *= 1E-7;
1394  ze = -2793*sin(l3-th2+nu) + 32387*sin(l3-th3+nu)
1395  +6871*sin(l3-th4+nu) - 16876*sin(l3-psi+nu);
1396  ze *= 1E-7;
1397 
1398  // convert to rectangular coordinates in Jovian equatorial
1399 
1400  rs.assign (ax * (1+xi) * cos(l3-psi+nu),
1401  ax * (1+xi) * sin(l3-psi+nu),
1402  ax * ze);
1403 
1404  // convert into ecliptic of 1950.0
1405 
1406  mt1 = xrot (-ii);
1407  rs = mxvct (mt1, rs);
1408  mt1 = zrot (-(psi-omj));
1409  rs = mxvct (mt1, rs);
1410  mt1 = xrot (-jj);
1411  rs = mxvct (mt1, rs);
1412  mt1 = zrot (-omj);
1413  rs = mxvct (mt1, rs);
1414 
1415  // convert into ecliptic of date
1416  mt1 = pmatecl (-0.500002096, t);
1417  rs = mxvct (mt1, rs);
1418 
1419  return rs;
1420 
1421  }
1422 
1423 /*--------------------- PosCallisto --------------------------------------*/
1424 Vec3 PosCallisto (double t)
1425  {
1426  /*
1427  Ecliptic coordinates (in A.U.)
1428  of Callisto with respect to Jupiter for Equinox of Date.
1429  t is the time in Julian centuries since J2000.
1430  =====================================================================*/
1431 
1432  const double pi2 = M_PI * 2.0;
1433  const double ax = 0.012585436;
1434  const double omj = 99.99754*M_PI/180.0;
1435  const double jj = 1.30691*M_PI/180.0;
1436  const double ii = 3.10401*M_PI/180.0;
1437 
1438  double l3, l4, p3, p4;
1439  double pij, th3, th4, psi, gp, gg, ph2;
1440  double xi, nu, ze;
1441  double d; // : EXTENDED;
1442  Vec3 rs;
1443  Mat3 mt1;
1444 
1445  // general jupiter moon data
1446  d = t*36525.0 + 8544.5;
1447  l3 = pi2 * frac((120.5613855 + 50.31760915340462*d)/360.0);
1448  l4 = pi2 * frac((84.455823 + 21.57107087517961*d)/360.0);
1449  // phl = pi2* frac((184.415351 + 0.17356902*d)/360.0);
1450  p3 = pi2 * frac((187.550171 + 0.00712408*d)/360.0);
1451  p4 = pi2 * frac((335.309254 + 0.00183939*d)/360.0);
1452  pij = 0.23510274429; // 13.470395
1453  th3 = pi2* frac((118.908928 - 0.00717678*d)/360.0);
1454  th4 = pi2* frac((322.746564 - 0.00176018*d)/360.0);
1455  psi = pi2* frac((316.500101 - 0.00000248*d)/360.0);
1456  gp = pi2 * frac((31.9785280244 + 0.033459733896*d)/360.0);
1457  gg = pi2 * frac((30.2380210168 + 0.08309256178969453*d)/360.0);
1458  ph2 = 0.91009489942; // 52.1445966929
1459 
1460  // Callisto specific lines
1461  xi = 1656*cos(l4-p3) - 73328*cos(l4-p4)
1462  +182*cos(l4-pij) - 541*cos(l4+p4-2*(pij+gg))
1463  -269*cos(2*(l4-p4)) + 974*cos(l3-l4);
1464  xi *= 1E-7;
1465  nu = -407*sin(2*(psi-p4)) + 309*sin(-2*p4+th4+psi)
1466  -4840*sin(2*(psi-pij)) + 2074*sin(-th4+psi)
1467  -5605*sin(gg) - 204*sin(2*gg)
1468  -495*sin(5*gp-2*gg+ph2) + 234*sin(p4-pij)
1469  -6112*sin(p3-p4) - 3318*sin(l4-p3)
1470  +145573*sin(l4-p4) + 178*sin(l4-pij-gg)
1471  -363*sin(l4-pij) + 1085*sin(l4+p4-2*(pij+gg))
1472  +672*sin(2*(l4-p4)) + 218*sin(2*(l4-pij-gg))
1473  +167*sin(2*l4-th4-psi) - 142*sin(2*(l4-psi))
1474  +148*sin(l3-2*l4+p4) - 390*sin(l3-l4)
1475  -195*sin(2*(l3-l4)) + 185*sin(3*l3-7*l4+4*p4);
1476  nu *= 1E-7;
1477  ze = 773*sin(l4-2*(pij+gg)+psi+nu)
1478  -5075*sin(l4-th3+nu) + 44300*sin(l4-th4+nu)
1479  -76493*sin(l4-psi+nu);
1480  ze *= 1E-7;
1481 
1482  rs.assign(ax * (1+xi) * cos(l4-psi+nu),
1483  ax * (1+xi) * sin(l4-psi+nu),
1484  ax * ze);
1485 
1486  // convert into ecliptic of 1950.0
1487 
1488  mt1 = xrot (-ii);
1489  rs = mxvct (mt1, rs);
1490  mt1 = zrot (-(psi-omj));
1491  rs = mxvct (mt1, rs);
1492  mt1 = xrot (-jj);
1493  rs = mxvct (mt1, rs);
1494  mt1 = zrot (-omj);
1495  rs = mxvct (mt1, rs);
1496 
1497  // convert into ecliptic of date
1498  mt1 = pmatecl (-0.500002096, t);
1499  rs = mxvct (mt1, rs);
1500 
1501  return rs;
1502 
1503  }
1504 
1505 
1506 /*--------------------- JupIo --------------------------------------*/
1507 void JupIo (double t, Vec3& rs, Vec3& vs)
1508  {
1509  /*
1510  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1511  of Io with respect to Jupiter for Equinox of Date.
1512  t is the time in Julian centuries since J2000.
1513  ====================================================================*/
1514 
1515  const double dlt = 3.472222E-4; // 30 sec
1516 
1517  double td;
1518 
1519  td = dlt / 36525;
1520  rs = PosJIo (t-td);
1521  vs = PosJIo (t+td);
1522  vs -= rs;
1523  td = 0.5/dlt;
1524  vs *= td;
1525  rs = PosJIo (t);
1526 
1527  }
1528 
1529 /*--------------------- JupEuropa --------------------------------------*/
1530 void JupEuropa (double t, Vec3& rs, Vec3& vs)
1531  {
1532  /*
1533  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1534  of Europa with respect to Jupiter for Equinox of Date.
1535  t is the time in Julian centuries since J2000.
1536  ====================================================================*/
1537 
1538  const double dlt = 3.472222E-4; // 30 sec
1539 
1540  double td;
1541 
1542  td = dlt / 36525;
1543  rs = PosEuropa (t-td);
1544  vs = PosEuropa (t+td);
1545  vs -= rs;
1546  td = 0.5/dlt;
1547  vs *= td;
1548  rs = PosEuropa (t);
1549 
1550  }
1551 
1552 /*--------------------- JupGanymede ------------------------------------*/
1553 void JupGanymede (double t, Vec3& rs, Vec3& vs)
1554  {
1555  /*
1556  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1557  of Ganimede with respect to Jupiter for Equinox of Date.
1558  t is the time in Julian centuries since J2000.
1559  ====================================================================*/
1560 
1561  const double dlt = 3.472222E-4; // 30 sec
1562 
1563  double td;
1564 
1565  td = dlt / 36525;
1566  rs = PosGanymede (t-td);
1567  vs = PosGanymede (t+td);
1568  vs -= rs;
1569  td = 0.5/dlt;
1570  vs *= td;
1571  rs = PosGanymede (t);
1572 
1573  }
1574 
1575 /*--------------------- JupCallisto ------------------------------------*/
1576 void JupCallisto (double t, Vec3& rs, Vec3& vs)
1577  {
1578  /*
1579  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1580  of Callisto with respect to Jupiter for Equinox of Date.
1581  t is the time in Julian centuries since J2000.
1582  ====================================================================*/
1583 
1584  const double dlt = 3.472222E-4; // 30 sec
1585 
1586  double td;
1587 
1588  td = dlt / 36525;
1589  rs = PosCallisto (t-td);
1590  vs = PosCallisto (t+td);
1591  vs -= rs;
1592  td = 0.5/dlt;
1593  vs *= td;
1594  rs = PosCallisto (t);
1595 
1596  }
1597 
1598 
1599 /*----------------------- SatRhea ------------------------------------*/
1600 void SatRhea (double t, Vec3& rs, Vec3& vs)
1601  {
1602  /*
1603  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1604  of Rhea with respect to Saturn for Equinox of Date.
1605  t is the time in Julian centuries since J2000.
1606  ====================================================================*/
1607 
1608  const double pi2 = M_PI * 2.0;
1609  const double ie = 28.0771*M_PI/180.0;
1610  const double oe = 168.8263*M_PI/180.0;
1611  const double kap = 57.29578*M_PI/180.0;
1612  const double ax = 0.003524;
1613  const double sg0 = 5.7682811893E-3; // sin(0.3305)
1614 
1615  double d, td, tt, pp, ot, nt;
1616  double lam, ii, omg, omb, ee;
1617  Mat3 mt1;
1618 
1619  // various times
1620  tt = t*36525.0;
1621  d = tt + 40452.0;
1622  td = 0.5219*(tt+40177)/365.25;
1623  tt = d / 365.25;
1624 
1625  // Titan perturbations
1626  pp = pi2 * frac((305.0 + 10.2077*tt)/360.0);
1627  ot = pi2 * frac((276.49 + td)/360.0);
1628  nt = pi2 * frac((44.5 - td)/360.0);
1629 
1630  // osculating orbit elements
1631  ee = 0.00021*sin(pp) + 0.001*sin(ot);
1632  omg = 0.00021*cos(pp) + 0.001*cos(ot);
1633  omb = atan2(ee,omg);
1634  ii = sin(omb);
1635  if (fabs(ii) > 0.5) ee = fabs(ee/ii);
1636  else ee = fabs(omg/cos(omb));
1637  pp = pi2 * frac((356.87 - 10.2077*tt)/360.0);
1638  ot = sin(pp);
1639  lam = pi2 * frac((359.4727 + 79.69004007*d)/360.0);
1640  lam = lam + kap*sg0*tan(0.5*ie)*ot;
1641  ii = ie - 7.9412480966E-4 + kap*sg0*cos(pp)
1642  + 3.5081117965E-4*cos(nt);
1643  omg = oe - 1.3613568166E-4
1644  + (kap*sg0*ot + 3.5081117965E-4*sin(nt))/sin(ie);
1645 
1646  // in-orbit-plane position vector
1647  pp = lam - omb; // mean anomaly
1648  pp = eccanom (pp, ee); // eccentric anomaly
1649  rs.assign (ax * (cos(pp) - ee), ax * sqrt(1.0 - ee*ee) * sin(pp), 0);
1650 
1651  // in-orbit-plane velocity vector
1652  d = cos(pp);
1653  td = 1.0 - ee*d;
1654  td = 4.9000413575E-3 / td;
1655  vs.assign (-td*sin(pp), td*sqrt(1.0-ee*ee)*d, 0);
1656 
1657  // convert to ecliptic coordinates
1658  pp = omb - omg;
1659  mt1 = zrot (-pp);
1660  rs = mxvct (mt1, rs);
1661  vs = mxvct (mt1, vs);
1662  mt1 = xrot (-ii);
1663  rs = mxvct (mt1, rs);
1664  vs = mxvct (mt1, vs);
1665  mt1 = zrot (-omg);
1666  rs = mxvct (mt1, rs);
1667  vs = mxvct (mt1, vs);
1668 
1669  // convert to ecliptic coordinates of date
1670  mt1 = pmatecl (-0.500002096, t);
1671  rs = mxvct (mt1, rs);
1672  vs = mxvct (mt1, vs);
1673 
1674  }
1675 
1676 /*----------------------- SatTitan ------------------------------------*/
1677 void SatTitan (double t, Vec3& rs, Vec3& vs)
1678  {
1679  /*
1680  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1681  of Titan with respect to Saturn for Equinox of Date.
1682  t is the time in Julian centuries since J2000.
1683  ===================================================================*/
1684 
1685  const double pi2 = M_PI * 2.0;
1686  const double ie = 28.0771*M_PI/180.0;
1687  const double oe = 168.8263*M_PI/180.0;
1688  const double kap = 57.29578*M_PI/180.0;
1689  const double ax = 0.00816765;
1690  const double sg0 = 5.7682811893E-3; // sin(0.3305)
1691 
1692  double d, tt, ts, gg, ls, is, os, lms, psi;
1693  double lam, ii, omg, omb, ee, s4;
1694  Mat3 mt1;
1695 
1696  // various times
1697  ts = t + 1.0;
1698  tt = t*36525.0;
1699  d = tt+40177;
1700  tt = d / 365.25;
1701 
1702  // solar perturbations
1703  ls = pi2 * frac((175.4762 + 1221.5515*ts)/360.0);
1704  is = pi2 * frac((2.4891 + 0.002435*ts)/360.0);
1705  os = pi2 * frac((113.35 - 0.2597*ts)/360.0);
1706  lms = pi2* frac((267.2635 + 1222.1136*ts)/360.0);
1707 
1708  gg = pi2 * frac((41.28 - 0.5219*tt)/360.0);
1709  ii = ie - 1.0828022679E-2 + kap*5.2185107774E-3*cos(gg);
1710  s4 = sin(gg);
1711  omg = oe - 2.4748768793E-3 + kap*5.2185107774E-3*s4/sin(ie);
1712  omb = pi2 * frac((275.837 + 0.5219*tt)/360.0);
1713 
1714  psi = sin(is)*sin(omg-os);
1715  gg = cos(omg-os);
1716  ts = cos(is)*sin(ii) - sin(is)*cos(ii)*gg;
1717  psi = atan2(psi,ts);
1718  ts = cos(is)*sin(ii)*gg - sin(is)*cos(ii);
1719  gg = sin(ii)*sin(omg-os);
1720  gg = atan2(gg,ts);
1721  lms = lms - gg - os;
1722  gg = omb - omg - psi;
1723 
1724  // osculating orbit elements
1725  ts = 2*(lms-gg);
1726  ee = 0.028815 - 0.000184*cos(2*gg) + 0.000073*cos(ts);
1727  omb = omb + kap*(0.00630*sin(2*gg) + 0.0025*sin(ts));
1728  gg = 2*lms + psi;
1729  lam = pi2 * frac((261.3121 + 22.57697385*d)/360.0)
1730  +kap*(sg0*tan(0.5*ie)*s4 - 0.000176*sin(ls)
1731  -0.000215*sin(2*lms) + 0.000057*sin(gg));
1732  ii = ii + 0.000232*kap*cos(gg);
1733  omg = omg + 0.000503*kap*sin(gg);
1734 
1735  // in-orbit-plane position vector
1736  gg = lam - omb; // mean anomaly
1737  if (gg < 0) gg += pi2;
1738  gg = eccanom (gg, ee); // eccentric anomaly
1739  rs.assign (ax * (cos(gg) - ee), ax * sqrt(1.0 - ee*ee) * sin(gg), 0);
1740 
1741  // in-orbit-plane velocity vector
1742  d = cos(gg);
1743  ts = 1.0 - ee*d;
1744  ts = 3.2183196288E-3 / ts;
1745  vs.assign (-ts*sin(gg), ts*sqrt(1.0-ee*ee)*d, 0);
1746 
1747  // convert to ecliptic coordinates
1748  gg = omb - omg;
1749  mt1 = zrot (-gg);
1750  rs = mxvct (mt1, rs);
1751  vs = mxvct (mt1, vs);
1752  mt1 = xrot (-ii);
1753  rs = mxvct (mt1, rs);
1754  vs = mxvct (mt1, vs);
1755  mt1 = zrot (-omg);
1756  rs = mxvct (mt1, rs);
1757  vs = mxvct (mt1, vs);
1758 
1759  // convert to ecliptic coordinates of date
1760  mt1 = pmatecl (-0.500002096, t);
1761  rs = mxvct (mt1, rs);
1762  vs = mxvct (mt1, vs);
1763 
1764  }
1765 
1766 
1767 /*----------------------- NepTriton ------------------------------------*/
1768 void NepTriton (double t, Vec3& rs, Vec3& vs)
1769  {
1770  /*
1771  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1772  of Triton with respect to Neptune for Equinox of Date.
1773  t is the time in Julian centuries since J2000.
1774  ====================================================================*/
1775 
1776  const double pi2 = M_PI * 2.0;
1777  const double ax = 0.00237142;
1778  const double gam = 158.996*M_PI/180.0;
1779 
1780  double d, nn, u, jj, ap;
1781  Mat3 mt1;
1782 
1783  // days since epoch
1784  d = t*36525 + 18262.5;
1785 
1786  // pole of fixed plane in 1950.0
1787  nn = pi2 * frac((359.28 + 54.308*t)/360.0);
1788  rs.assign (1.0,
1789  pi2 * frac((298.72+2.58*sin(nn)-0.04*sin(2*nn))/360.0),
1790  pi2 * frac((42.63-1.9*cos(nn)+0.01*cos(2*nn))/360.0));
1791  rs = polcar (rs);
1792  mt1 = pmatequ (0.0, -0.500002096);
1793  rs = mxvct (mt1, rs);
1794  rs = carpol (rs);
1795  jj = M_PI/2.0;
1796  ap = rs[1] + jj; // R.A. of ascending node
1797  jj = jj - rs[2]; // inclination
1798 
1799  // in-orbit-plane position vector
1800 
1801  u = pi2 * frac((200.913 + 61.2588532*d)/360.0);
1802  rs.assign (ax * cos(u), ax * sin(u), 0);
1803 
1804  // velocity is perpendicular to radius vector for e=0
1805  u = 1.0 / abs(rs);
1806  vs = u * rs;
1807  mt1 = zrot (-M_PI/2.0);
1808  vs = mxvct (mt1, vs);
1809  u = 2.53538612E-3; // mean orbital speed
1810  vs *= u;
1811 
1812  // convert to equatorial coordinates
1813  mt1 = xrot (-gam);
1814  rs = mxvct (mt1, rs);
1815  vs = mxvct (mt1, vs);
1816  nn = pi2 * frac((151.401 + 0.57806*d/365.25)/360.0);
1817  mt1 = zrot (-nn);
1818  rs = mxvct (mt1, rs);
1819  vs = mxvct (mt1, vs);
1820  mt1 = xrot (-jj);
1821  rs = mxvct (mt1, rs);
1822  vs = mxvct (mt1, vs);
1823  mt1 = zrot (-ap);
1824  rs = mxvct (mt1, rs);
1825  vs = mxvct (mt1, vs);
1826 
1827  // convert to ecliptic coordinates of date
1828  mt1 = pmatequ (-0.500002096, t);
1829  rs = mxvct (mt1, rs);
1830  vs = mxvct (mt1, vs);
1831  rs = equecl (t, rs);
1832  vs = equecl (t, vs);
1833 
1834  }
1835 
1836 
1837 /*----------------------- PluCharon ------------------------------------*/
1838 void PluCharon (double t, Vec3& rs, Vec3& vs)
1839  {
1840  /*
1841  Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day)
1842  of Charon with respect to Pluto for Equinox of Date.
1843  t is the time in Julian centuries since J2000.
1844  ====================================================================*/
1845 
1846  const double pi2 = M_PI * 2.0;
1847  const double ax = 0.00013102;
1848  const double jj = 94.3*M_PI/180.0;
1849  const double nn = 223.7*M_PI/180.0;
1850 
1851  double d, u;
1852  Mat3 mt1;
1853 
1854  // days since epoch
1855  d = t*36525 + 6544.5;
1856 
1857  // in-orbit-plane position vector
1858  u = pi2 * frac((78.6 + 56.3625*d)/360.0);
1859  rs.assign (ax * cos(u), ax * sin(u), 0);
1860 
1861  // velocity is perpendicular to radius vector for e=0
1862  d = 1.0 / abs(rs);
1863  vs = d * rs;
1864  mt1 = zrot (-M_PI/2.0);
1865  vs = mxvct (mt1, vs);
1866  d = 1.288837578E-4; // mean orbital speed
1867  vs *= d;
1868 
1869  // convert to equatorial coordinates
1870  mt1 = xrot (-jj);
1871  rs = mxvct (mt1, rs);
1872  vs = mxvct (mt1, vs);
1873  mt1 = zrot (-nn);
1874  rs = mxvct (mt1, rs);
1875  vs = mxvct (mt1, vs);
1876 
1877  // convert to ecliptic coordinates of date
1878  mt1 = pmatequ (-0.500002096, t);
1879  rs = mxvct (mt1, rs);
1880  vs = mxvct (mt1, vs);
1881  rs = equecl (t, rs);
1882  vs = equecl (t, vs);
1883 
1884  }
1885 
MarPhobos
void MarPhobos(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1049
JupEuropa
void JupEuropa(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1530
NepTriton
void NepTriton(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1768
Mat3
Definition: attlib.h:63
equecl
Vec3 equecl(double t, Vec3 &r1)
Definition: astrolib.cpp:358
JupGanymede
void JupGanymede(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1553
Vec3
Definition: attlib.h:27
PluCharon
void PluCharon(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1838
astrolib.h
atan21
double atan21(double y, double x)
JupCallisto
void JupCallisto(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1576
Plan200::Uranus
Vec3 Uranus(double t)
Definition: astr2lib.cpp:729
carpol
Vec3 carpol(const Vec3 &c)
Definition: attlib.cpp:184
attlib.h
zrot
Mat3 zrot(double a)
Definition: attlib.cpp:530
Plan200::Mercury
Vec3 Mercury(double t)
Definition: astr2lib.cpp:97
pmatequ
Mat3 pmatequ(double t1, double t2)
Definition: astrolib.cpp:408
Plan200::Neptune
Vec3 Neptune(double t)
Definition: astr2lib.cpp:860
JupIo
void JupIo(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1507
frac
double frac(double f)
Definition: astrolib.cpp:30
Plan200::velocity
Vec3 velocity() const
Definition: astr2lib.cpp:62
PosGanymede
Vec3 PosGanymede(double t)
Definition: astr2lib.cpp:1341
Plan200::Plan200
Plan200()
Definition: astr2lib.cpp:38
pmatecl
Mat3 pmatecl(double t1, double t2)
Definition: astrolib.cpp:375
Plan200::Mars
Vec3 Mars(double t)
Definition: astr2lib.cpp:321
PosCallisto
Vec3 PosCallisto(double t)
Definition: astr2lib.cpp:1424
SatRhea
void SatRhea(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1600
abs
double abs(const Vec3 &c)
Definition: attlib.cpp:100
Plan200::state
void state(Vec3 &rs, Vec3 &vs) const
Definition: astr2lib.cpp:67
MarDeimos
void MarDeimos(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1119
Plan200::Pluto
Vec3 Pluto(double t)
Definition: astr2lib.cpp:944
SatTitan
void SatTitan(double t, Vec3 &rs, Vec3 &vs)
Definition: astr2lib.cpp:1677
Plan200::Saturn
Vec3 Saturn(double t)
Definition: astr2lib.cpp:596
eccanom
double eccanom(double man, double ecc)
Definition: astrolib.cpp:915
Vec3::assign
void assign(double x=0, double y=0, double z=0)
Definition: attlib.cpp:46
PosJIo
Vec3 PosJIo(double t)
Definition: astr2lib.cpp:1190
M_PI
#define M_PI
Definition: GeoDataCoordinates.h:26
xrot
Mat3 xrot(double a)
Definition: attlib.cpp:488
astr2lib.h
Plan200::Jupiter
Vec3 Jupiter(double t)
Definition: astr2lib.cpp:492
polcar
Vec3 polcar(const Vec3 &c)
Definition: attlib.cpp:207
mxvct
Vec3 mxvct(const Mat3 &m1, Vec3 &v1)
Definition: attlib.cpp:473
Plan200::Venus
Vec3 Venus(double t)
Definition: astr2lib.cpp:213
PosEuropa
Vec3 PosEuropa(double t)
Definition: astr2lib.cpp:1261
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal