File indexing completed on 2025-01-05 03:58:38
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2014 Gerhard Holtkamp 0004 // 0005 0006 /* ========================================================================= 0007 Procedures for calculating the positions of planets. 0008 The procedures in this unit are taken from Montenbruck, Pfleger 0009 "Astronomie mit dem Personal Computer", Springer Verlag, 1989 0010 and modified correspondingly. 0011 The library Astrolib has to be included. 0012 0013 Copyright :Gerhard HOLTKAMP 26-MAR-2014 0014 ========================================================================= */ 0015 0016 #include "astr2lib.h" 0017 #include <cmath> 0018 using namespace std; 0019 0020 #include "astrolib.h" 0021 0022 extern double frac (double f); 0023 extern double atan21 (double y, double x); 0024 0025 0026 /*-------------------- Class Plan200 --------------------------------------*/ 0027 /* 0028 Ecliptic coordinates (in A.U.) and velocity (in A.U./day) 0029 of the Planets for Equinox of Date given in Julian centuries since J2000. 0030 ====================================================================== 0031 */ 0032 Plan200::Plan200 () 0033 { } 0034 0035 void Plan200::addthe (double c1, double s1, double c2, double s2, double& cc, double& ss) 0036 { 0037 cc=c1*c2-s1*s2; 0038 ss=s1*c2+c1*s2; 0039 } 0040 0041 void Plan200::term (int i1, int i, int it, double dlc, double dls, double drc, 0042 double drs, double dbc, double dbs) 0043 { 0044 if (it == 0) addthe (c3[i1],s3[i1],c[i],s[i],u,v); 0045 else 0046 { 0047 u=u*tt; 0048 v=v*tt; 0049 } 0050 dl = dl + dlc*u + dls*v; 0051 dr = dr + drc*u + drs*v; 0052 db = db + dbc*u + dbs*v; 0053 } 0054 0055 Vec3 Plan200::velocity() // return last calculated planet velocity 0056 { 0057 return vp; 0058 } 0059 0060 void Plan200::state (Vec3& rs, Vec3& vs) 0061 { 0062 /* State vector rs (position) and vs (velocity) of the Sun in 0063 ecliptic of date coordinates for last calculated planet 0064 */ 0065 rs = rp; 0066 vs = vp; 0067 } 0068 0069 void Plan200::posvel () 0070 { 0071 /* auxiliary program to calculate position and velocity 0072 vectors rp, vp. 0073 to be called by the various planet procedures. 0074 */ 0075 0076 double cl, sl, cb, sb; 0077 0078 cl = cos(l); sl = sin(l); cb = cos(b); sb = sin(b); 0079 rp[0] = r*cl*cb; rp[1] = r*sl*cb; rp[2] = r*sb; 0080 0081 // velocity 0082 vp[0] = (dr*cl*cb - dl*r*sl*cb - db*r*cl*sb) * 1E-4; 0083 vp[1] = (dr*sl*cb + dl*r*cl*cb - db*r*sl*sb) * 1E-4; 0084 vp[2] = (dr*sb + db*r*cb) * 1E-4; 0085 } 0086 0087 /*--------------------- Mercury ------------------------------------------*/ 0088 0089 Vec3 Plan200::Mercury (double t) // position of Mercury at time t 0090 { 0091 /* 0092 Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day) 0093 of Mercury for Equinox of Date. 0094 t is the time in Julian centuries since J2000. 0095 */ 0096 0097 const double arc = 206264.81; // 3600*180/pi = ''/r 0098 const double p2 = M_PI * 2.0; 0099 0100 int i; 0101 0102 tt = t; 0103 dl = 0.0; dr = 0.0; db = 0.0; 0104 m1 = p2 * frac(0.4855407 + 415.2014314*t); 0105 m2 = p2 * frac(0.1394222 + 162.5490444*t); 0106 m3 = p2 * frac(0.9937861 + 99.9978139*t); 0107 m5 = p2 * frac(0.0558417 + 8.4298417*t); 0108 m6 = p2 * frac(0.8823333 + 3.3943333*t); 0109 c3[1] = 1.0; s3[1]= 0.0; 0110 c3[2] = cos(m1); s3[2] = sin(m1); c3[0] = c3[2]; s3[0] = -s3[2]; 0111 for (i=3; i<11; i++) 0112 addthe(c3[i-1],s3[i-1],c3[2],s3[2],c3[i],s3[i]); 0113 0114 // perturbations by Venus 0115 c[5] = 1.0; s[5] = 0.0; c[4] = cos(m2); s[4] = -sin(m2); 0116 for (i=4; i>0; i--) 0117 addthe(c[i],s[i],c[4],s[4],c[i-1],s[i-1]); 0118 term(2, 5, 0, 259.74, 84547.39, -78342.34,0.01,11683.22,21203.79); 0119 term(2, 5, 1, 2.3, 5.04, -7.52, 0.02, 138.55, -71.01); 0120 term(2, 5, 2, 0.01, -0.01, 0.01, 0.01, -0.19, -0.54); 0121 term(3, 5, 0, -549.71, 10394.44, -7955.45, 0.0, 2390.29, 4306.79); 0122 term(3, 5, 1, -4.77, 8.97, -1.53, 0.0, 28.49, -14.18); 0123 term(3, 5, 2, 0.0, 0.0, 0.0, 0.0, -0.04, -0.11); 0124 term(4, 5, 0, -234.04, 1748.74, -1212.86, 0.0, 535.41, 984.33); 0125 term(4, 5, 1, -2.03, 3.48, -0.35, 0.0, 6.56, -2.91); 0126 term(5, 5, 0, -77.64, 332.63, -219.23, 0.0, 124.4, 237.03); 0127 term(5, 5, 1, -0.7, 1.1, -0.08, 0.0, 1.59, -0.59); 0128 term(6, 5, 0, -23.59, 67.28, -43.54, 0.0, 29.44, 58.77); 0129 term(6, 5, 1, -0.23, 0.32, -0.02, 0.0, 0.39, -0.11); 0130 term(7, 5, 0, -6.86, 14.06, -9.18, 0.0, 7.03, 14.84); 0131 term(7, 5, 1, -0.07, 0.09, -0.01, 0.0, 0.1, -0.02); 0132 term(8, 5, 0, -1.94, 2.98, -2.02, 0.0, 1.69, 3.8); 0133 term(9, 5, 0, -0.54, 0.63, -0.46, 0.0, 0.41, 0.98); 0134 term(10, 5, 0, -0.15, 0.13, -0.11, 0.0, 0.1, 0.25); 0135 term(0, 3, 0, -0.17, -0.06, -0.05, 0.14, -0.06, -0.07); 0136 term(1, 4, 0, 0.24, -0.16, -0.11, -0.16, 0.04, -0.01); 0137 term(1, 3, 0, -0.68, -0.25, -0.26, 0.73, -0.16, -0.18); 0138 term(1, 0, 0, 0.37, 0.08, 0.06, -0.28, 0.13, 0.12); 0139 term(2, 4, 0, 0.58, -0.41, 0.26, 0.36, 0.01, -0.01); 0140 term(2, 3, 0, -3.51, -1.23, 0.23, -0.63, -0.05, -0.06); 0141 term(2, 2, 0, 0.08, 0.53, -0.11, 0.04, 0.02, -0.09); 0142 term(2, 0, 0, 1.44, 0.31, 0.3, -1.39, 0.34, 0.29); 0143 term(3, 4, 0, 0.15, -0.11, 0.09, 0.12, 0.02, -0.04); 0144 term(3, 3, 0, -1.99, -0.68, 0.65, -1.91, -0.2, 0.03); 0145 term(3, 2, 0, -0.34, -1.28, 0.97, -0.26, 0.03, 0.03); 0146 term(3, 1, 0, -0.33, 0.35, -0.13, -0.13, -0.01, 0.0); 0147 term(3, 0, 0, 7.19, 1.56, -0.05, 0.12, 0.06, 0.05); 0148 term(4, 3, 0, -0.52, -0.18, 0.13, -0.39, -0.16, 0.03); 0149 term(4, 2, 0, -0.11, -0.42, 0.36, -0.1, -0.05, -0.05); 0150 term(4, 1, 0, -0.19, 0.22, -0.23, -0.2, -0.01, 0.02); 0151 term(4, 0, 0, 2.77, 0.49, -0.45, 2.56, 0.4, -0.12); 0152 term(5, 0, 0, 0.67, 0.12, -0.09, 0.47, 0.24, -0.08); 0153 term(6, 0, 0, 0.18, 0.03, -0.02, 0.12, 0.09, -0.03); 0154 0155 // perturbations by Earth 0156 c[4] = cos(m3); s[4] = -sin(m3); 0157 for (i=4; i>1; i--) 0158 addthe(c[i],s[i],c[4],s[4],c[i-1],s[i-1]); 0159 term(1, 1, 0, -0.11, -0.07, -0.08, 0.11, -0.02, -0.04); 0160 term(2, 4, 0, 0.1, -0.2, 0.15, 0.07, 0.0, 0.0); 0161 term(2, 3, 0, -0.35, 0.28, -0.13, -0.17, -0.01, 0.0); 0162 term(2, 1, 0, -0.67, -0.45, 0.0, 0.01, -0.01, -0.01); 0163 term(3, 3, 0, -0.2, 0.16, -0.16, -0.2, -0.01, 0.02); 0164 term(3, 2, 0, 0.13, -0.02, 0.02, 0.14, 0.01, 0.0); 0165 term(3, 1, 0, -0.33, -0.18, 0.17, -0.31, -0.04, 0.0); 0166 0167 // perturbations by Jupiter 0168 c[4] = cos(m5); s[4] = -sin(m5); 0169 for (i=4; i>2; i--) 0170 addthe(c[i],s[i],c[4],s[4],c[i-1],s[i-1]); 0171 term(0, 4, 0, -0.08, 0.16, 0.15, 0.08, -0.04, 0.01); 0172 term(0, 3, 0, 0.1, -0.06, -0.07, -0.12, 0.07, -0.01); 0173 term(1, 4, 0, -0.31, 0.48, -0.02, 0.13, -0.03, -0.02); 0174 term(1, 3, 0, 0.42, -0.26, -0.38, -0.5, 0.2, -0.03); 0175 term(2, 4, 0, -0.7, 0.01, -0.02, -0.63, 0.0, 0.03); 0176 term(2, 3, 0, 2.61, -1.97, 1.74, 2.32, 0.01, 0.01); 0177 term(2, 2, 0, 0.32, -0.15, 0.13, 0.28, 0.0, 0.0); 0178 term(3, 4, 0, -0.18, 0.01, 0.0, -0.13, -0.03, 0.03); 0179 term(3, 3, 0, 0.75, -0.56, 0.45, 0.6, 0.08, -0.17); 0180 term(4, 3, 0, 0.2, -0.15, 0.1, 0.14, 0.04, -0.08); 0181 0182 // perturbations by Saturn 0183 c[3] = cos(2*m6); s[3] = -sin(2*m6); 0184 term(2, 3, 0, -0.19, 0.33, 0.0, 0.0, 0.0, 0.0); 0185 0186 dl = dl + (2.8 + 3.2*t); 0187 l = p2 * frac(0.2151379 + m1/p2 + ((5601.7+1.1*t)*t+dl)/1296.0e3); 0188 b = (-2522.15+(-30.18+0.04*t)*t+db) / arc; 0189 r = 0.3952829 +0.0000016*t + dr*1.0e-6; 0190 dl = 714.0+292.66*cos(m1)+71.96*cos(2*m1)+18.16*cos(3*m1) 0191 +4.61*cos(4*m1)+3.81*sin(2*m1)+2.43*sin(3*m1)+1.08*sin(4*m1); 0192 dr = 55.94*sin(m1)+11.36*sin(2*m1)+2.6*sin(3*m1); 0193 db = 73.4*cos(m1)+29.82*cos(2*m1)+10.22*cos(3*m1)+3.28*cos(4*m1) 0194 -40.44*sin(m1)-16.55*sin(2*m1)-5.56*sin(3*m1)-1.72*sin(4*m1); 0195 0196 posvel(); 0197 0198 return rp; 0199 } 0200 0201 /*--------------------- Venus ------------------------------------------*/ 0202 0203 Vec3 Plan200::Venus (double t) // position of Venus at time t 0204 { 0205 /* 0206 Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day) 0207 of Venus for Equinox of Date. 0208 t is the time in Julian centuries since J2000. 0209 */ 0210 0211 const double arc = 206264.81; // 3600*180/pi = ''/r 0212 const double p2 = M_PI * 2.0; 0213 0214 int i; 0215 0216 tt = t; 0217 dl = 0.0; dr = 0.0; db = 0.0; 0218 m1 = p2 * frac(0.4861431+415.2018375*t); 0219 m2 = p2 * frac(0.1400197+162.5494552*t); 0220 m3 = p2 * frac(0.9944153+99.9982208*t); 0221 m4 = p2 * frac(0.0556297+53.1674631*t); 0222 m5 = p2 * frac(0.0567028+8.4305083*t); 0223 m6 = p2 * frac(0.8830539+3.3947206*t); 0224 0225 c3[0] = 1.0; s3[0] = 0.0; c3[1] = cos(m2); s3[1] = sin(m2); 0226 for (i=2; i<9; i++) 0227 addthe(c3[i-1],s3[i-1],c3[1],s3[1],c3[i],s3[i]); 0228 0229 // perturbations by Mercury 0230 c[8] = 1.0; s[8] = 0.0; c[7] = cos(m1); s[7] = -sin(m1); 0231 addthe(c[7],s[7],c[7],s[7],c[6],s[6]); 0232 term(1, 7, 0, 0.0, 0.0, 0.06, -0.09, 0.01, 0.0); 0233 term(2, 7, 0, 0.25, -0.09, -0.09, -0.27, 0.0, 0.0); 0234 term(4, 6, 0, -0.07, -0.08, -0.14, 0.14, -0.01, -0.01); 0235 term(5, 6, 0, -0.35, 0.08, 0.02, 0.09, 0.0, 0.0); 0236 0237 // perturbations by Earth 0238 c[7] = cos(m3); s[7] = -sin(m3); 0239 for (i=7; i>0; i--) 0240 addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]); 0241 term(1, 8, 0, 2.37, 2793.23, -4899.07, 0.11, 9995.27, 7027.22); 0242 term(1, 8, 1, 0.1, -19.65, 34.4, 0.22, 64.95, -86.1); 0243 term(1, 8, 2, 0.06, 0.04, -0.07, 0.11, -0.55, -0.07); 0244 term(2, 8, 0, -170.42, 73.13, -16.59, 0.0, 67.71, 47.56); 0245 term(2, 8, 1, 0.93, 2.91, 0.23, 0.0, -0.03, -0.92); 0246 term(3, 8, 0, -2.31, 0.9, -0.08, 0.0, 0.04, 2.09); 0247 term(1, 7, 0, -2.38, -4.27, 3.27, -1.82, 0.0, 0.0); 0248 term(1, 6, 0, 0.09, 0.0, -0.08, 0.05, -0.02, -0.25); 0249 term(2, 6, 0, -9.57, -5.93, 8.57, -13.83, -0.01, -0.01); 0250 term(2, 5, 0, -2.47, -2.4, 0.83, -0.95, 0.16, 0.24); 0251 term(3, 6, 0, -0.09, -0.05, 0.08, -0.13, -0.28, 0.12); 0252 term(3, 5, 0, 7.12, 0.32, -0.62, 13.76, -0.07, 0.01); 0253 term(3, 4, 0, -0.65, -0.17, 0.18, -0.73, 0.1, 0.05); 0254 term(3, 3, 0, -1.08, -0.95, -0.17, 0.22, -0.03, -0.03); 0255 term(4, 5, 0, 0.06, 0.0, -0.01, 0.08, 0.14, -0.18); 0256 term(4, 4, 0, 0.93, -0.46, 1.06, 2.13, -0.01, 0.01); 0257 term(4, 3, 0, -1.53, 0.38, -0.64, -2.54, 0.27, 0.0); 0258 term(4, 2, 0, -0.17, -0.05, 0.03, -0.11, 0.02, 0.0); 0259 term(5, 3, 0, 0.18, -0.28, 0.71, 0.47, -0.02, 0.04); 0260 term(5, 2, 0, 0.15, -0.14, 0.3, 0.31, -0.04, 0.03); 0261 term(5, 1, 0, -0.08, 0.02, -0.03, -0.11, 0.01, 0.0); 0262 term(5, 0, 0, -0.23, 0.0, 0.01, -0.04, 0.0, 0.0); 0263 term(6, 2, 0, 0.01, -0.14, 0.39, 0.04, 0.0, -0.01); 0264 term(6, 1, 0, 0.02, -0.05, 0.12, 0.04, -0.01, 0.01); 0265 term(6, 0, 0, 0.1, -0.1, 0.19, 0.19, -0.02, 0.02); 0266 term(7, 1, 0, -0.03, -0.06, 0.18, -0.08, 0.0, 0.0); 0267 term(8, 0, 0, -0.03, -0.02, 0.06, -0.08, 0.0, 0.0); 0268 0269 // perturbations by Mars 0270 c[7] = cos(m4); s[7] = -sin(m4); 0271 for (i=7; i>5; i--) 0272 addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]); 0273 term(1, 5, 0, -0.65, 1.02, -0.04, -0.02, -0.02, 0.0); 0274 term(2, 6, 0, -0.05, 0.04, -0.09, -0.1, 0.0, 0.0); 0275 term(2, 5, 0, -0.5, 0.45, -0.79, -0.89, 0.01, 0.03); 0276 0277 // perturbations by Jupiter 0278 c[7] = cos(m5); s[7] = -sin(m5); 0279 for (i=7; i>5; i--) 0280 addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]); 0281 term(0, 7, 0, -0.05, 1.56, 0.16, 0.04, -0.08, -0.04); 0282 term(1, 7, 0, -2.62, 1.4, -2.35, -4.4, 0.02, 0.03); 0283 term(1, 6, 0, -0.47, -0.08, 0.12, -0.76, 0.04, -0.18); 0284 term(2, 6, 0, -0.73, -0.51, 1.27, -1.82, -0.01, 0.01); 0285 term(2, 5, 0, -0.14, -0.1, 0.25, -0.34, 0.0, 0.0); 0286 term(3, 5, 0, -0.01, 0.04, -0.11, -0.02, 0.0, 0.0); 0287 0288 // perturbations by Saturn 0289 c[7] = cos(m6); s[7] = -sin(m6); 0290 term(0, 7, 0, 0.0, 0.21, 0.0, 0.0, 0.0, -0.01); 0291 term(1, 7, 0, -0.11, -0.14, 0.24, -0.2, 0.01, 0.0); 0292 0293 dl = dl+2.74*sin(p2*(0.0764+0.4174*t))+0.27*sin(p2*(0.9201+0.3307*t)); 0294 dl = dl+(1.9+1.8*t); 0295 0296 l = p2 * frac(0.3654783 + m2/p2 + ((5071.2+1.1*t)*t+dl)/1296.0e3); 0297 b = (-67.7+(0.04+0.01*t)*t+db)/arc; 0298 r = 0.7233482-0.0000002*t+dr*1.0e-6; 0299 0300 dl = 280.0+3.79*cos(m2); 0301 dr = 1.37*sin(m2); 0302 db = 9.54*cos(m2)-13.57*sin(m2); 0303 0304 posvel(); 0305 0306 return rp; 0307 } 0308 0309 /*--------------------- Mars ------------------------------------------*/ 0310 0311 Vec3 Plan200::Mars (double t) // position of Mars at time t 0312 { 0313 /* 0314 Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day) 0315 of Mars for Equinox of Date. 0316 t is the time in Julian centuries since J2000. 0317 */ 0318 0319 const double arc = 206264.81; // 3600*180/pi = ''/r 0320 const double p2 = M_PI * 2.0; 0321 0322 int i; 0323 0324 tt = t; 0325 dl = 0.0; dr = 0.0; db = 0.0; 0326 m2 = p2 * frac(0.1382208+162.5482542*t); 0327 m3 = p2 * frac(0.9926208+99.9970236*t); 0328 m4 = p2 * frac(0.0538553+53.1662736*t); 0329 m5 = p2 * frac(0.0548944+8.4290611*t); 0330 m6 = p2 * frac(0.8811167+3.3935250*t); 0331 c3[2] = 1.0; s3[2] = 0.0; c3[3] = cos(m4); s3[3] = sin(m4); 0332 for (i=4; i<19; i++) 0333 addthe(c3[i-1],s3[i-1],c3[3],s3[3],c3[i],s3[i]); 0334 c3[0] = c3[4]; 0335 s3[0] = -s3[4]; 0336 c3[1] = c3[3]; 0337 s3[1] = -s3[3]; 0338 0339 // perturbations by Venus 0340 c[9] = 1.0; s[9] = 0.0; c[8] = cos(m2); s[8] = -sin(m2); 0341 addthe (c[8],s[8],c[8],s[8],c[7],s[7]); 0342 term(2, 8, 0, -0.01, -0.03, 0.1, -0.04, 0.0, 0.0); 0343 term(3, 8, 0, 0.05, 0.1, -2.08, 0.75, 0.0, 0.0); 0344 term(4, 8, 0, -0.25, -0.57, -2.58, 1.18, 0.05, -0.04); 0345 term(4, 7, 0, 0.02, 0.02, 0.13, -0.14, 0.0, 0.0); 0346 term(5, 8, 0, 3.41, 5.38, 1.87, -1.15, 0.01, -0.01); 0347 term(5, 7, 0, 0.02, 0.02, 0.11, -0.13, 0.0, 0.0); 0348 term(6, 8, 0, 0.32, 0.49, -1.88, 1.21, -0.07, 0.07); 0349 term(6, 7, 0, 0.03, 0.03, 0.12, -0.14, 0.0, 0.0); 0350 term(7, 8, 0, 0.04, 0.06, -0.17, 0.11, -0.01, 0.01); 0351 term(7, 7, 0, 0.11, 0.09, 0.35, -0.43, -0.01, 0.01); 0352 term(8, 7, 0, -0.36, -0.28, -0.2, 0.25, 0.0, 0.0); 0353 term(9, 7, 0, -0.03, -0.03, 0.11, -0.13, 0.0, 0.0); 0354 0355 // perturbations by Earth 0356 c[8] = cos(m3); s[8] = -sin(m3); 0357 for (i=8; i>0; i--) 0358 addthe(c[i],s[i],c[8],s[8],c[i-1],s[i-1]); 0359 term(3, 9, 0, -5.32, 38481.97, -141856.04, 0.4, -6321.67, 1876.89); 0360 term(3, 9, 1, -1.12, 37.98, -138.67, -2.93, 37.28, 117.48); 0361 term(3, 9, 2, -0.32, -0.03, 0.12, -1.19, 1.04, -0.4); 0362 term(4, 9, 0, 28.28, 2285.8, -6608.37, 0.0, -589.35, 174.81); 0363 term(4, 9, 1, 1.64, 3.37, -12.93, 0.0, 2.89, 11.1); 0364 term(4, 9, 2, 0.0, 0.0, 0.0, 0.0, 0.1, -0.03); 0365 term(5, 9, 0, 5.31, 189.29, -461.81, 0.0, -61.98, 18.53); 0366 term(5, 9, 1, 0.31, 0.35, -1.36, 0.0, 0.25, 1.19); 0367 term(6, 9, 0, 0.81, 17.96, -38.26, 0.0, -6.88, 2.08); 0368 term(6, 9, 1, 0.05, 0.04, -0.15, 0.0, 0.02, 0.14); 0369 term(7, 9, 0, 0.11, 1.83, -3.48, 0.0, -0.79, 0.24); 0370 term(8, 9, 0, 0.02, 0.2, -0.34, 0.0, -0.09, 0.3); 0371 term(1, 8, 0, 0.09, 0.06, 0.14, -0.22, 0.02, -0.02); 0372 term(2, 8, 0, 0.72, 0.49, 1.55, -2.31, 0.12, -0.1); 0373 term(3, 8, 0, 7.0, 4.92, 13.93, -20.48, 0.08, -0.13); 0374 term(4, 8, 0, 13.08, 4.89, -4.53, 10.01, -0.05, 0.13); 0375 term(4, 7, 0, 0.14, 0.05, -0.48, -2.66, 0.01, 0.14); 0376 term(5, 8, 0, 1.38, 0.56, -2.0, 4.85, -0.01, 0.19); 0377 term(5, 7, 0, -6.85, 2.68, 8.38, 21.42, 0.0, 0.03); 0378 term(5, 6, 0, -0.08, 0.2, 1.2, 0.46, 0.0, 0.0); 0379 term(6, 8, 0, 0.16, 0.07, -0.19, 0.47, -0.01, 0.05); 0380 term(6, 7, 0, -4.41, 2.14, -3.33, -7.21, -0.07, -0.09); 0381 term(6, 6, 0, -0.12, 0.33, 2.22, 0.72, -0.03, -0.02); 0382 term(6, 5, 0, -0.04, -0.06, -0.36, 0.23, 0.0, 0.0); 0383 term(7, 7, 0, -0.44, 0.21, -0.7, -1.46, -0.06, -0.07); 0384 term(7, 6, 0, 0.48, -2.6, -7.25, -1.37, 0.0, 0.0); 0385 term(7, 5, 0, -0.09, -0.12, -0.66, 0.5, 0.0, 0.0); 0386 term(7, 4, 0, 0.03, 0.0, 0.01, -0.17, 0.0, 0.0); 0387 term(8, 7, 0, -0.05, 0.03, -0.07, -0.15, -0.01, -0.01); 0388 term(8, 6, 0, 0.1, -0.96, 2.36, 0.3, 0.04, 0.0); 0389 term(8, 5, 0, -0.17, -0.2, -1.09, 0.94, 0.02, -0.02); 0390 term(8, 4, 0, 0.05, 0.0, 0.0, -0.3, 0.0, 0.0); 0391 term(9, 6, 0, 0.01, -0.1, 0.32, 0.04, 0.02, 0.0); 0392 term(9, 5, 0, 0.86, 0.77, 1.86, -2.01, 0.01, -0.01); 0393 term(9, 4, 0, 0.09, -0.01, -0.05, -0.44, 0.0, 0.0); 0394 term(9, 3, 0, -0.01, 0.02, 0.1, 0.08, 0.0, 0.0); 0395 term(10, 5, 0, 0.2, 0.16, -0.53, 0.64, -0.01, 0.02); 0396 term(10, 4, 0, 0.17, -0.03, -0.14, -0.84, 0.0, 0.01); 0397 term(10, 3, 0, -0.02, 0.03, 0.16, 0.09, 0.0, 0.0); 0398 term(11, 4, 0, -0.55, 0.15, 0.3, 1.1, 0.0, 0.0); 0399 term(11, 3, 0, -0.02, 0.04, 0.2, 0.1, 0.0, 0.0); 0400 term(12, 4, 0, -0.09, 0.03, -0.1, -0.33, 0.0, -0.01); 0401 term(12, 3, 0, -0.05, 0.11, 0.48, 0.21, -0.01, 0.0); 0402 term(13, 3, 0, 0.1, -0.35, -0.52, -0.15, 0.0, 0.0); 0403 term(13, 2, 0, -0.01, -0.02, -0.1, 0.07, 0.0, 0.0); 0404 term(14, 3, 0, 0.01, -0.04, 0.18, 0.4, 0.01, 0.0); 0405 term(14, 2, 0, -0.05, -0.07, -0.29, 0.2, 0.01, 0.0); 0406 term(15, 2, 0, 0.23, 0.27, 0.25, -0.21, 0.0, 0.0); 0407 term(16, 2, 0, 0.02, 0.03, -0.1, 0.09, 0.0, 0.0); 0408 term(16, 1, 0, 0.05, 0.01, 0.03, -0.23, 0.0, 0.3); 0409 term(17, 1, 0, -1.53, 0.27, 0.06, 0.42, 0.0, 0.0); 0410 term(18, 1, 0, -0.14, 0.02, -0.1, -0.55, -0.01, -0.02); 0411 term(18, 0, 0, 0.03, -0.06, -0.25, -0.11, 0.0, 0.0); 0412 0413 // perturbation by Jupiter 0414 c[8] = cos(m5); s[8] = -sin(m5); 0415 for (i=8; i>4; i--) 0416 addthe(c[i],s[i],c[8],s[8],c[i-1],s[i-1]); 0417 term(0, 8, 0, 0.05, 0.03, 0.08, -0.14, 0.01, -0.01); 0418 term(1, 8, 0, 0.39, 0.27, 0.92, -1.5, -0.03, -0.06); 0419 term(1, 7, 0, -0.16, 0.03, 0.13, 0.67, -0.01, 0.06); 0420 term(1, 6, 0, -0.02, 0.01, 0.05, 0.09, 0.0, 0.01); 0421 term(2, 8, 0, 3.56, 1.13, -5.41, -7.18, -0.25, -0.24); 0422 term(2, 7, 0, -1.44, 0.25, 1.24, 7.96, 0.02, 0.31); 0423 term(2, 6, 0, -0.21, 0.11, 0.55, 1.04, 0.01, 0.05); 0424 term(2, 5, 0, -0.02, 0.02, 0.11, 0.11, 0.0, 0.01); 0425 term(3, 8, 0, 16.67, -19.15, 61.0, 53.36, -0.06, -0.07); 0426 term(3, 7, 0, -21.64, 3.18, -7.77, -54.64, -0.31, 0.5); 0427 term(3, 6, 0, -2.82, 1.45, -2.53, -5.73, 0.01, 0.07); 0428 term(3, 5, 0, -0.31, 0.28, -0.34, -0.51, 0.0, 0.0); 0429 term(4, 8, 0, 2.15, -2.29, 7.04, 6.94, 0.33, 0.19); 0430 term(4, 7, 0, -15.69, 3.31, -15.7, -73.17, -0.17, -0.25); 0431 term(4, 6, 0, -1.73, 1.95, -9.19, -7.2, 0.02, -0.03); 0432 term(4, 5, 0, -0.01, 0.33, -1.42, 0.08, 0.01, -0.01); 0433 term(4, 4, 0, 0.03, 0.03, -0.13, 0.12, 0.0, 0.0); 0434 term(5, 8, 0, 0.26, -0.28, 0.73, 0.71, 0.08, 0.04); 0435 term(5, 7, 0, -2.06, 0.46, -1.61, -6.72, -0.13, -0.25); 0436 term(5, 6, 0, -1.28, -0.27, 2.21, -6.9, -0.04, -0.02); 0437 term(5, 5, 0, -0.22, 0.08, -0.44, -1.25, 0.0, 0.01); 0438 term(5, 4, 0, -0.02, 0.03, -0.15, -0.08, 0.0, 0.0); 0439 term(6, 8, 0, 0.03, -0.03, 0.08, 0.08, 0.01, 0.01); 0440 term(6, 7, 0, -0.26, 0.06, -0.17, -0.7, -0.03, -0.05); 0441 term(6, 6, 0, -0.2, -0.05, 0.22, -0.79, -0.01, -0.02); 0442 term(6, 5, 0, -0.11, -0.14, 0.93, -0.6, 0.0, 0.0); 0443 term(6, 4, 0, -0.04, -0.02, 0.09, -0.23, 0.0, 0.0); 0444 term(7, 5, 0, -0.02, -0.03, 0.13, -0.09, 0.0, 0.0); 0445 term(7, 4, 0, 0.0, -0.03, 0.21, 0.01, 0.0, 0.0); 0446 0447 // perturbations by Saturn 0448 c[8] = cos(m6); s[8] = -sin(m6); 0449 for (i=8; i>5; i--) 0450 addthe(c[i],s[i],c[8],s[8],c[i-1],s[i-1]); 0451 term(1, 8, 0, 0.03, 0.13, 0.48, -0.13, 0.02, 0.0); 0452 term(2, 8, 0, 0.27, 0.84, 0.4, -0.43, 0.01, -0.01); 0453 term(2, 7, 0, 0.12, -0.04, -0.33, -0.55, -0.01, -0.02); 0454 term(2, 6, 0, 0.02, -0.01, -0.07, -0.08, 0.0, 0.0); 0455 term(3, 8, 0, 1.12, 0.76, -2.66, 3.91, -0.01, 0.01); 0456 term(3, 7, 0, 1.49, -0.95, 3.07, 4.83, 0.04, -0.05); 0457 term(3, 6, 0, 0.21, -0.18, 0.55, 0.64, 0.0, 0.0); 0458 term(4, 8, 0, 0.12, 0.1, -0.29, 0.34, -0.01, 0.02); 0459 term(4, 7, 0, 0.51, -0.36, 1.61, 2.25, 0.03, 0.01); 0460 term(4, 6, 0, 0.1, -0.1, 0.5, 0.43, 0.0, 0.0); 0461 term(4, 5, 0, 0.01, -0.02, 0.11, 0.05, 0.0, 0.0); 0462 term(5, 7, 0, 0.07, -0.05, 0.16, 0.22, 0.01, 0.01); 0463 0464 dl = dl+52.49*sin(p2*(0.1868+0.0549*t))+0.61*sin(p2*(0.922+0.3307*t)) 0465 +0.32*sin(p2*(0.4731+2.1485*t))+0.28*sin(p2*(0.9467+1.1133*t)); 0466 dl = dl + (0.14+0.87*t-0.11*t*t); 0467 l = p2 * frac(0.9334591+m4/p2+((6615.5+1.1*t)*t+dl)/1296.0e3); 0468 r = 1.5303352 + 0.0000131*t + dr*1.0e-6; 0469 b = (596.32+(-2.92-0.1*t)*t+db) / arc; 0470 0471 dl = 91.50 + 17.07*cos(m4) + 2.03*cos(2*m4); 0472 dr = 12.98*sin(m4) + 1.21*cos(2*m4); 0473 db = 0.83*cos(m4) + 2.8*sin(m4); 0474 0475 posvel(); 0476 0477 return rp; 0478 } 0479 0480 /*--------------------- Jupiter ------------------------------------------*/ 0481 0482 Vec3 Plan200::Jupiter (double t) // position of Jupiter at time t 0483 { 0484 /* 0485 Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day) 0486 of Jupiter for Equinox of Date. 0487 t is the time in Julian centuries since J2000. 0488 */ 0489 0490 const double arc = 206264.81; // 3600*180/pi = ''/r 0491 const double p2 = M_PI * 2.0; 0492 0493 int i; 0494 0495 tt = t; 0496 dl = 0.0; dr = 0.0; db = 0.0; 0497 m5 = p2 * frac(0.0565314+8.4302963*t); 0498 m6 = p2 * frac(0.8829867+3.3947688*t); 0499 m7 = p2 * frac(0.3969537+1.1902586*t); 0500 c3[1] = 1.0; s3[1] = 0.0; 0501 c3[2] = cos(m5); s3[2] = sin(m5); c3[0] = c3[2]; s3[0] = -s3[2]; 0502 for (i=3; i<7; i++) 0503 addthe(c3[i-1],s3[i-1],c3[2],s3[2],c3[i],s3[i]); 0504 0505 // perturbations by Saturn 0506 c[10] = 1.0; s[10] = 0.0; c[9] = cos(m6); s[9] = -sin(m6); 0507 for (i=9; i>0; i--) 0508 addthe(c[i],s[i],c[9],s[9],c[i-1],s[i-1]); 0509 term(0, 9, 0, -0.2, 1.4, 2.0, 0.6, 0.1, -0.2); 0510 term(1, 9, 0, 9.4, 8.9, 3.9, -8.3, -0.4, -1.4); 0511 term(1, 8, 0, 5.6, -3.0, -5.4, -5.7, -2.0, 0.0); 0512 term(1, 7, 0, -4.0, -0.1, 0.0, 5.5, 0.0, 0.0); 0513 term(1, 5, 0, 3.3, -1.6, -1.6, -3.1, -0.5, -1.2); 0514 term(2, 10, 0, -113.1, 19998.6, -25208.2, -142.2, -4670.7, 288.9); 0515 term(2, 10, 1, -76.1, 66.9, -84.2, -95.8, 21.6, 29.4); 0516 term(2, 10, 2, -0.5, -0.3, 0.4, -0.7, 0.1, -0.1); 0517 term(2, 9, 0, 78.8, -14.5, 11.5, 64.4, -0.2, 0.2); 0518 term(2, 8, 0, -2.0, -132.4, 28.8, 4.3, -1.7, 0.4); 0519 term(2, 8, 1, -1.1, -0.7, 0.2, -0.3, 0.0, 0.0); 0520 term(2, 7, 0, -7.5, -6.8, -0.4, -1.1, 0.6, -0.9); 0521 term(2, 6, 0, 0.7, 0.7, 0.6, -1.1, 0.0, -0.2); 0522 term(2, 5, 0, 51.5, -26.0, -32.5, -64.4, -4.9, -12.4); 0523 term(2, 5, 1, -1.2, -2.2, -2.7, 1.5, -0.4, 0.3); 0524 term(3, 10, 0, -3.4, 632.0, -610.6, -6.5, -226.8, 12.7); 0525 term(3, 10, 1, -4.2, 3.8, -4.1, -4.5, 0.2, 0.6); 0526 term(3, 9, 0, 5.3, -0.7, 0.7, 6.1, 0.2, 1.1); 0527 term(3, 8, 0, -76.4, -185.1, 260.2, -108.0, 1.6, 0.0); 0528 term(3, 7, 0, 66.7, 47.8, -51.4, 69.8, 0.9, 0.3); 0529 term(3, 7, 1, 0.6, -1.0, 1.0, 0.6, 0.0, 0.0); 0530 term(3, 6, 0, 17.0, 1.4, -1.8, 9.6, 0.0, -0.1); 0531 term(3, 5, 0, 1066.2, -518.3, -1.3, -23.9, 1.8, -0.3); 0532 term(3, 5, 1, -25.4, -40.3, -0.9, 0.3, 0.0, 0.0); 0533 term(3, 5, 2, -0.7, 0.5, 0.0, 0.0, 0.0, 0.0); 0534 term(4, 10, 0, -0.1, 28.0, -22.1, -0.2, -12.5, 0.7); 0535 term(4, 8, 0, -5.0, -11.5, 11.7, -5.4, 2.1, -1.0); 0536 term(4, 7, 0, 16.9, -6.4, 13.4, 26.9, -0.5, 0.8); 0537 term(4, 6, 0, 7.2, -13.3, 20.9, 10.5, 0.1, -0.1); 0538 term(4, 5, 0, 68.5, 134.3, -166.9, 86.5, 7.1, 15.2); 0539 term(4, 5, 1, 3.5, -2.7, 3.4, 4.3, 0.5, -0.4); 0540 term(4, 4, 0, 0.6, 1.0, -0.9, 0.5, 0.0, 0.0); 0541 term(4, 3, 0, -1.1, 1.7, -0.4, -0.2, 0.0, 0.0); 0542 term(5, 10, 0, 0.0, 1.4, -1.0, 0.0, -0.6, 0.0); 0543 term(5, 8, 0, -0.3, -0.7, 0.4, -0.2, 0.2, -0.1); 0544 term(5, 7, 0, 1.1, -0.6, 0.9, 1.2, 0.1, 0.2); 0545 term(5, 6, 0, 3.2, 1.7, -4.1, 5.8, 0.2, 0.1); 0546 term(5, 5, 0, 6.7, 8.7, -9.3, 8.7, -1.1, 1.6); 0547 term(5, 4, 0, 1.5, -0.3, 0.6, 2.4, 0.0, 0.0); 0548 term(5, 3, 0, -1.9, 2.3, -3.2, -2.7, 0.0, -0.1); 0549 term(5, 2, 0, 0.4, -1.8, 1.9, 0.5, 0.0, 0.0); 0550 term(5, 1, 0, -0.2, -0.5, 0.3, -0.1, 0.0, 0.0); 0551 term(5, 0, 0, -8.6, -6.8, -0.4, 0.1, 0.0, 0.0); 0552 term(5, 0, 1, -0.5, 0.6, 0.0, 0.0, 0.0, 0.0); 0553 term(6, 5, 0, -0.1, 1.5, -2.5, -0.8, -0.1, 0.1); 0554 term(6, 4, 0, 0.1, 0.8, -1.6, 0.1, 0.0, 0.0); 0555 term(6, 1, 0, -0.5, -0.1, 0.1, -0.8, 0.0, 0.0); 0556 term(6, 0, 0, 2.5, -2.2, 2.8, 3.1, 0.1, -0.2); 0557 0558 // perturbations by Uranus 0559 c[9] = cos(m7); s[9] = -sin(m7); 0560 addthe(c[9],s[9],c[9],s[9],c[8],s[8]); 0561 term(2, 9, 0, 0.4, 0.9, 0.0, 0.0, 0.0, 0.0); 0562 term(2, 8, 0, 0.4, 0.4, -0.4, 0.3, 0.0, 0.0); 0563 0564 // perturbations by Saturn and Uranus 0565 double phi, x, y; 0566 0567 phi = (2*m5-6*m6+3*m7); x = cos(phi); y = sin(phi); 0568 dl = dl-0.8*x+8.5*y; dr = dr-0.1*x; 0569 addthe(x,y,c3[2],s3[2],x,y); 0570 dl = dl+0.4*x+0.5*y; dr = dr-0.7*x+0.5*y; db = db-0.1*x; 0571 0572 l = p2 * frac(0.0388910 + m5/p2 + ((5025.2+0.8*t)*t+dl)/1296.0e3); 0573 b = (227.3 - 0.3*t + db) / arc; 0574 r = 5.208873 + 0.000041*t + dr*1.0e-5; 0575 0576 dl = 14.5+1.41*cos(m5); dr = 3.66*sin(m5); db = 0.33*sin(m5); 0577 0578 posvel(); 0579 0580 return rp; 0581 } 0582 0583 0584 /*--------------------- Saturn ------------------------------------------*/ 0585 0586 Vec3 Plan200::Saturn (double t) // position of Saturn at time t 0587 { 0588 /* 0589 Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day) 0590 of Saturn for Equinox of Date. 0591 t is the time in Julian centuries since J2000. 0592 */ 0593 0594 const double arc = 206264.81; // 3600*180/pi = ''/r 0595 const double p2 = M_PI * 2.0; 0596 0597 int i; 0598 0599 tt = t; 0600 dl = 0.0; dr = 0.0; db = 0.0; 0601 m5 = p2 * frac(0.0565314+8.4302963*t); 0602 m6 = p2 * frac(0.8829867+3.3947688*t); 0603 m7 = p2 * frac(0.3969537+1.1902586*t); 0604 m8 = p2 * frac(0.7208473+0.6068623*t); 0605 c3[0] = 1.0; s3[0] = 0.0; c3[1] = cos(m6); s3[1] = sin(m6); 0606 for (i=2; i<12; i++) 0607 addthe(c3[i-1],s3[i-1],c3[1],s3[1],c3[i],s3[i]); 0608 0609 // perturbations by Jupiter 0610 c[6] = 1.0; s[6] = 0.0; c[7] = cos(m5); s[7] = sin(m5); 0611 for (i=6; i>0; i--) 0612 addthe(c[i],s[i],c[7],-s[7],c[i-1],s[i-1]); 0613 term(0, 5, 0, 12.0, -1.4, -13.9, 6.4, 1.2, -1.8); 0614 term(0, 4, 0, 0.0, -0.2, -0.9, 1.0, 0.0, -0.1); 0615 term(1, 7, 0, 0.9, 0.4, -1.8, 1.9, 0.2, 0.2); 0616 term(1, 6, 0, -348.3, 22907.7, -52915.5, -752.2, -3266.5, 8314.4); 0617 term(1, 6, 1, -225.2, -146.2, 337.7, -521.3, 79.6, 17.4); 0618 term(1, 6, 2, 1.3, -1.4, 3.2, 2.9, 0.1, -0.4); 0619 term(1, 5, 0, -1.0, -30.7, 108.6, -815.0, -3.6, -9.3); 0620 term(1, 4, 0, -2.0, -2.7, -2.1, -11.9, -0.1, -0.4); 0621 term(2, 7, 0, 0.1, 0.2, -1.0, 0.3, 0.0, 0.0); 0622 term(2, 6, 0, 44.2, 724.0, -1464.3, -34.7, -188.7, 459.1); 0623 term(2, 6, 1, -17.0, -11.3, 18.9, -28.9, 1.0, -3.7); 0624 term(2, 5, 0, -3.5, -426.6, -546.5, -26.5, -1.6, -2.7); 0625 term(2, 5, 1, 3.5, -2.2, -2.6, -4.3, 0.0, 0.0); 0626 term(2, 4, 0, 10.5, -30.9, -130.5, -52.3, -1.9, 0.2); 0627 term(2, 3, 0, -0.2, -0.4, -1.2, -0.1, -0.1, 0.0); 0628 term(3, 6, 0, 6.5, 30.5, -61.1, 0.4, -11.6, 28.1); 0629 term(3, 6, 1, -1.2, -0.7, 1.1, -1.8, -0.2, -0.6); 0630 term(3, 5, 0, 29.0, -40.2, 98.2, 45.3, 3.2, -9.4); 0631 term(3, 5, 1, 0.6, 0.6, -1.0, 1.3, 0.0, 0.0); 0632 term(3, 4, 0, -27.0, -21.1, -68.5, 8.1, -19.8, 5.4); 0633 term(3, 4, 1, 0.9, -0.5, -0.4, -2.0, -0.1, -0.8); 0634 term(3, 3, 0, -5.4, -4.1, -19.1, 26.2, -0.1, -0.1); 0635 term(4, 6, 0, 0.6, 1.4, -3.0, -0.2, -0.6, 1.6); 0636 term(4, 5, 0, 1.5, -2.5, 12.4, 4.7, 1.0, -1.1); 0637 term(4, 4, 0, -821.9, -9.6, -26.0, 1873.6, -70.5, -4.4); 0638 term(4, 4, 1, 4.1, -21.9, -50.3, -9.9, 0.7, -3.0); 0639 term(4, 3, 0, -2.0, -4.7, -19.3, 8.2, -0.1, -0.3); 0640 term(4, 2, 0, -1.5, 1.3, 6.5, 7.3, 0.0, 0.0); 0641 term(5, 4, 0, -2627.6, -1277.3, 117.4, -344.1, -13.8, -4.3); 0642 term(5, 4, 1, 63.0, -98.6, 12.7, 6.7, 0.1, -0.2); 0643 term(5, 4, 2, 1.7, 1.2, -0.2, 0.3, 0.0, 0.0); 0644 term(5, 3, 0, 0.4, -3.6, -11.3, -1.6, 0.0, -0.3); 0645 term(5, 2, 0, -1.4, 0.3, 1.5, 6.3, -0.1, 0.0); 0646 term(5, 1, 0, 0.3, 0.6, 3.0, -1.7, 0.0, 0.0); 0647 term(6, 4, 0, -146.7, -73.7, 166.4, -334.3, -43.6, -46.7); 0648 term(6, 4, 1, 5.2, -6.8, 15.1, 11.4, 1.7, -1.0); 0649 term(6, 3, 0, 1.5, -2.9, -2.2, -1.3, 0.1, -0.1); 0650 term(6, 2, 0, -0.7, -0.2, -0.7, 2.8, 0.0, 0.0); 0651 term(6, 1, 0, 0.0, 0.5, 2.5, -0.1, 0.0, 0.0); 0652 term(6, 0, 0, 0.3, -0.1, -0.3, -1.2, 0.0, 0.0); 0653 term(7, 4, 0, -9.6, -3.9, 9.6, -18.6, -4.7, -5.3); 0654 term(7, 4, 1, 0.4, -0.5, 1.0, 0.9, 0.3, -0.1); 0655 term(7, 3, 0, 3.0, 5.3, 7.5, -3.5, 0.0, 0.0); 0656 term(7, 2, 0, 0.2, 0.4, 1.6, -1.3, 0.0, 0.0); 0657 term(7, 1, 0, -0.1, 0.2, 1.0, 0.5, 0.0, 0.0); 0658 term(7, 0, 0, 0.2, 0.0, 0.2, -1.0, 0.0, 0.0); 0659 term(8, 4, 0, -0.7, -0.2, 0.6, -1.2, -0.4, -0.4); 0660 term(8, 3, 0, 0.5, 1.0, -2.0, 1.5, 0.1, 0.2); 0661 term(8, 2, 0, 0.4, 1.3, 3.6, -0.9, 0.0, -0.1); 0662 term(9, 2, 0, 4.0, -8.7, -19.9, -9.9, 0.2, -0.4); 0663 term(9, 2, 1, 0.5, 0.3, 0.8, -1.8, 0.0, 0.0); 0664 term(10, 2, 0, 21.3, -16.8, 3.3, 3.3, 0.2, -0.2); 0665 term(10, 2, 1, 1.0, 1.7, -0.4, 0.4, 0.0, 0.0); 0666 term(11, 2, 0, 1.6, -1.3, 3.0, 3.7, 0.8, -0.2); 0667 0668 // perturbations by Uranus 0669 c[5] = cos(m7); s[5] = -sin(m7); 0670 for (i=5; i>1; i--) 0671 addthe(c[i],s[i],c[5],s[5],c[i-1],s[i-1]); 0672 term(0, 5, 0, 1.0, 0.7, 0.4, -1.5, 0.1, 0.0); 0673 term(0, 4, 0, 0.0, -0.4, -1.1, 0.1, -0.1, -0.1); 0674 term(0, 3, 0, -0.9, -1.2, -2.7, 2.1, -0.5, -0.3); 0675 term(1, 5, 0, 7.8, -1.5, 2.3, 12.7, 0.0, 0.0); 0676 term(1, 4, 0, -1.1, -8.1, 5.2, -0.3, -0.3, -0.3); 0677 term(1, 3, 0, -16.4, -21.0, -2.1, 0.0, 0.4, 0.0); 0678 term(2, 5, 0, 0.6, -0.1, 0.1, 1.2, 0.1, 0.0); 0679 term(2, 4, 0, -4.9, -11.7, 31.5, -13.3, 0.0, -0.2); 0680 term(2, 3, 0, 19.1, 10.0, -22.1, 42.1, 0.1, -1.1); 0681 term(2, 2, 0, 0.9, -0.1, 0.1, 1.4, 0.0, 0.0); 0682 term(3, 4, 0, -0.4, -0.9, 1.7, -0.8, 0.0, -0.3); 0683 term(3, 3, 0, 2.3, 0.0, 1.0, 5.7, 0.3, 0.3); 0684 term(3, 2, 0, 0.3, -0.7, 2.0, 0.7, 0.0, 0.0); 0685 term(3, 1, 0, -0.1, -0.4, 1.1, -0.3, 0.0, 0.0); 0686 0687 // perturbations by Neptune 0688 c[5] = cos(m8); s[5] = -sin(m8); 0689 addthe(c[5],s[5],c[5],s[5],c[4],s[4]); 0690 term(1, 5, 0, -1.3, -1.2, 2.3, -2.5, 0.0, 0.0); 0691 term(1, 4, 0, 1.0, -0.1, 0.1, 1.4, 0.0, 0.0); 0692 term(2, 4, 0, 1.1, -0.1, 0.2, 3.3, 0.0, 0.0); 0693 0694 // perturbations by Jupiter and Uranus 0695 double phi, x, y; 0696 0697 phi = (-2*m5+5*m6-3*m7); x = cos(phi); y = sin(phi); 0698 dl = dl-0.8*x-0.1*y; dr = dr-0.2*x+1.8*y; db = db+0.3*x+0.5*y; 0699 addthe(x,y,c3[1],s3[1],x,y); 0700 dl = dl+(2.4-0.7*t)*x+(27.8-0.4*t)*y; 0701 dr = dr+2.1*x-0.2*y; 0702 addthe(x,y,c3[1],s3[1],x,y); 0703 dl = dl+0.1*x+1.6*y; dr = dr-3.6*x+0.3*y; db = db-0.2*x+0.6*y; 0704 0705 l = p2 * frac(0.2561136+m6/p2+((5018.6+t*1.9)*t+dl)/1296.0e3); 0706 b = (175.1 - 10.2*t + db) / arc; 0707 r = 9.557584 - 0.000186*t + dr*1.0e-5; 0708 0709 dl = 5.84+0.65*cos(m6); dr = 3.09*sin(m6); db = 0.24*cos(m6); 0710 0711 posvel(); 0712 0713 return rp; 0714 } 0715 0716 0717 /*--------------------- Uranus ------------------------------------------*/ 0718 0719 Vec3 Plan200::Uranus (double t) // position of Uranus at time t 0720 { 0721 /* 0722 Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day) 0723 of Uranus for Equinox of Date. 0724 t is the time in Julian centuries since J2000. 0725 */ 0726 0727 const double arc = 206264.81; // 3600*180/pi = ''/r 0728 const double p2 = M_PI * 2.0; 0729 0730 int i; 0731 0732 tt = t; 0733 dl = 0.0; dr = 0.0; db = 0.0; 0734 m5 = p2 * frac(0.0564472+8.4302889*t); 0735 m6 = p2 * frac(0.8829611+3.3947583*t); 0736 m7 = p2 * frac(0.3967117+1.1902849*t); 0737 m8 = p2 * frac(0.7216833+0.6068528*t); 0738 c3[2] = 1.0; s3[2] = 0.0; c3[3] = cos(m7); s3[3] = sin(m7); 0739 for (i=4; i<10; i++) 0740 addthe(c3[i-1],s3[i-1],c3[3],s3[3],c3[i],s3[i]); 0741 c3[1] = c3[3]; 0742 s3[1] = -s3[3]; 0743 c3[0] = c3[4]; 0744 s3[0] = -s3[4]; 0745 0746 // perturbations by Jupiter 0747 c[8] = 1.0; s[8] = 0.0; c[7] = cos(m5); s[7] = -sin(m5); 0748 addthe(c[7],s[7],c[7],s[7],c[6],s[6]); 0749 term(1, 7, 0, 0.0, 0.0, -0.1, 1.7, -0.1, 0.0); 0750 term(2, 7, 0, 0.5, -1.2, 18.9, 9.1, -0.9, 0.1); 0751 term(3, 7, 0, -21.2, 48.7, -455.5, -198.8, 0.0, 0.0); 0752 term(3, 6, 0, -0.5, 1.2, -10.9, -4.8, 0.0, 0.0); 0753 term(4, 7, 0, -1.3, 3.2, -23.2, -11.1, 0.3, 0.1); 0754 term(4, 6, 0, -0.2, 0.2, 1.1, 1.5, 0.0, 0.0); 0755 term(5, 7, 0, 0.0, 0.2, -1.8, 0.4, 0.0, 0.0); 0756 0757 // perturbations by Saturn 0758 c[7] = cos(m6); s[7] = -sin(m6); 0759 for (i=7; i>4; i--) 0760 addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]); 0761 term(2, 7, 0, 1.4, -0.5, -6.4, 9.0, -0.4, -0.8); 0762 term(3, 7, 0, -18.6, -12.6, 36.7, -336.8, 1.0, 0.3); 0763 term(3, 6, 0, -0.7, -0.3, 0.5, -7.5, 0.1, 0.0); 0764 term(4, 7, 0, 20.0, -141.6, -587.1, -107.0, 3.1, -0.8); 0765 term(4, 7, 1, 1.0, 1.4, 5.8, -4.0, 0.0, 0.0); 0766 term(4, 6, 0, 1.6, -3.8, -35.6, -16.0, 0.0, 0.0); 0767 term(5, 7, 0, 75.3, -100.9, 128.9, 77.5, -0.8, 0.1); 0768 term(5, 7, 1, 0.2, 1.8, -1.9, 0.3, 0.0, 0.0); 0769 term(5, 6, 0, 2.3, -1.3, -9.5, -17.9, 0.0, 0.1); 0770 term(5, 5, 0, -0.7, -0.5, -4.9, 6.8, 0.0, 0.0); 0771 term(6, 7, 0, 3.4, -5.0, 21.6, 14.3, -0.8, -0.5); 0772 term(6, 6, 0, 1.9, 0.1, 1.2, -12.1, 0.0, 0.0); 0773 term(6, 5, 0, -0.1, -0.4, -3.9, 1.2, 0.0, 0.0); 0774 term(6, 4, 0, -0.2, 0.1, 1.6, 1.8, 0.0, 0.0); 0775 term(7, 7, 0, 0.2, -0.3, 1.0, 0.6, -0.1, 0.0); 0776 term(7, 6, 0, -2.2, -2.2, -7.7, 8.5, 0.0, 0.0); 0777 term(7, 5, 0, 0.1, -0.2, -1.4, -0.4, 0.0, 0.0); 0778 term(7, 4, 0, -0.1, 0.0, 0.1, 1.2, 0.0, 0.0); 0779 term(8, 6, 0, -0.2, -0.6, 1.4, -0.7, 0.0, 0.0); 0780 0781 // perturbations by Neptune 0782 c[7] = cos(m8); s[7] = -sin(m8); 0783 for (i=7; i>0; i--) 0784 addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]); 0785 term(3, 8, 0, -78.1, 19518.1, -90718.2, -334.7, 2759.5, -311.9); 0786 term(3, 8, 1, -81.6, 107.7, -497.4, -379.5, -2.8, -43.7); 0787 term(3, 8, 2, -6.6, -3.1, 14.4, -30.6, -0.4, -0.5); 0788 term(3, 8, 3, 0.0, -0.5, 2.4, 0.0, 0.0, 0.0); 0789 term(4, 8, 0, -2.4, 586.1, -2145.2, -15.3, 130.6, -14.3); 0790 term(4, 8, 1, -4.5, 6.6, -24.2, -17.8, 0.7, -1.6); 0791 term(4, 8, 2, -0.4, 0.0, 0.1, -1.4, 0.0, 0.0); 0792 term(5, 8, 0, 0.0, 24.5, -76.2, -0.6, 7.0, -0.7); 0793 term(5, 8, 1, -0.2, 0.4, -1.4, -0.8, 0.1, -0.1); 0794 term(6, 8, 0, 0.0, 1.1, -3.0, 0.1, 0.4, 0.0); 0795 term(1, 7, 0, -0.2, 0.2, 0.7, 0.7, -0.1, 0.0); 0796 term(2, 7, 0, -2.8, 2.5, 8.7, 10.5, -0.4, -0.1); 0797 term(3, 7, 0, -28.4, 20.3, -51.4, -72.0, 0.0, 0.0); 0798 term(3, 6, 0, -0.6, -0.1, 4.2, -14.6, 0.2, 0.4); 0799 term(3, 5, 0, 0.2, 0.5, 3.4, -1.6, -0.1, 0.1); 0800 term(4, 7, 0, -1.8, 1.3, -5.5, -7.7, 0.0, 0.3); 0801 term(4, 6, 0, 29.4, 10.2, -29.0, 83.2, 0.0, 0.0); 0802 term(4, 5, 0, 8.8, 17.8, -41.9, 21.5, -0.1, -0.3); 0803 term(4, 4, 0, 0.0, 0.1, -2.1, -0.9, 0.1, 0.0); 0804 term(5, 6, 0, 1.5, 0.5, -1.7, 5.1, 0.1, -0.2); 0805 term(5, 5, 0, 4.4, 14.6, -84.3, 25.2, 0.1, -0.1); 0806 term(5, 4, 0, 2.4, -4.5, 12.0, 6.2, 0.0, 0.0); 0807 term(5, 3, 0, 2.9, -0.9, 2.1, 6.2, 0.0, 0.0); 0808 term(6, 5, 0, 0.3, 1.0, -4.0, 1.1, 0.1, -0.1); 0809 term(6, 4, 0, 2.1, -2.7, 17.9, 14.0, 0.0, 0.0); 0810 term(6, 3, 0, 3.0, -0.4, 2.3, 17.6, -0.1, -0.1); 0811 term(6, 2, 0, -0.6, -0.5, 1.1, -1.6, 0.0, 0.0); 0812 term(7, 4, 0, 0.2, -0.2, 1.0, 0.8, 0.0, 0.0); 0813 term(7, 3, 0, -0.9, -0.1, 0.6, -7.1, 0.0, 0.0); 0814 term(7, 2, 0, -0.5, -0.6, 3.8, -3.6, 0.0, 0.0); 0815 term(7, 1, 0, 0.0, -0.5, 3.0, 0.1, 0.0, 0.0); 0816 term(8, 2, 0, 0.2, 0.3, -2.7, 1.6, 0.0, 0.0); 0817 term(8, 1, 0, -0.1, 0.2, -2.0, -0.4, 0.0, 0.0); 0818 term(9, 1, 0, 0.1, -0.2, 1.3, 0.5, 0.0, 0.0); 0819 term(9, 0, 0, 0.1, 0.0, 0.4, 0.9, 0.0, 0.0); 0820 0821 // perturbations by Jupiter and Saturn 0822 c[7] = cos(m6); s[7] = -sin(m6); 0823 c[4] = cos(-4*m6+2*m5); s[4] = sin(-4*m6+2*m5); 0824 for (i=4; i>2; i--) 0825 addthe(c[i],s[i],c[7],s[7],c[i-1],s[i-1]); 0826 term(0, 4, 0, -0.7, 0.4, -1.5, -2.5, 0.0, 0.0); 0827 term(1, 4, 0, -0.1, -0.1, -2.2, 1.0, 0.0, 0.0); 0828 term(3, 3, 0, 0.1, -0.4, 1.4, 0.2, 0.0, 0.0); 0829 term(3, 2, 0, 0.4, 0.5, -0.8, -0.8, 0.0, 0.0); 0830 term(4, 2, 0, 5.7, 6.3, 28.5, -25.5, 0.0, 0.0); 0831 term(4, 2, 1, 0.1, -0.2, -1.1, -0.6, 0.0, 0.0); 0832 term(5, 2, 0, -1.4, 29.2, -11.4, 1.1, 0.0, 0.0); 0833 term(5, 2, 1, 0.8, -0.4, 0.2, 0.3, 0.0, 0.0); 0834 term(6, 2, 0, 0.0, 1.3, -6.0, -0.1, 0.0, 0.0); 0835 0836 l = p2 * frac(0.4734843+m7/p2+((5082.3+34.2*t)*t+dl)/1296.0E3); 0837 b = (-130.61+(-0.54+0.04*t)*t+db)/arc; 0838 r = 19.211991+(-0.000333-0.000005*t)*t+dr*1.0e-5; 0839 0840 dl = 2.05+0.19*cos(m7); dr = 1.86*sin(m7); db = -0.03*sin(m7); 0841 0842 posvel(); 0843 0844 return rp; 0845 } 0846 0847 0848 /*--------------------- Neptune ------------------------------------------*/ 0849 0850 Vec3 Plan200::Neptune (double t) // position of Neptune at time t 0851 { 0852 /* 0853 Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day) 0854 of Neptune for Equinox of Date. 0855 t is the time in Julian centuries since J2000. 0856 */ 0857 0858 const double arc = 206264.81; // 3600*180/pi = ''/r 0859 const double p2 = M_PI * 2.0; 0860 0861 int i; 0862 0863 tt = t; 0864 dl = 0.0; dr = 0.0; db = 0.0; 0865 m5 = p2 * frac(0.0563867+8.4298907*t); 0866 m6 = p2 * frac(0.8825086+3.3957748*t); 0867 m7 = p2 * frac(0.3965358+1.1902851*t); 0868 m8 = p2 * frac(0.7214906+0.6068526*t); 0869 c3[0] = 1.0; s3[0] = 0.0; c3[1] = cos(m8); s3[1] = sin(m8); 0870 for (i=2; i<7; i++) 0871 addthe(c3[i-1],s3[i-1],c3[1],s3[1],c3[i],s3[i]); 0872 0873 // perturbations by Jupiter 0874 c[6] = 1.0; s[6] = 0.0; c[5] = cos(m5); s[5] = -sin(m5); 0875 addthe(c[5],s[5],c[5],s[5],c[4],s[4]); 0876 term(0, 5, 0, 0.1, 0.1, -3.0, 1.8, -0.3, -0.3); 0877 term(1, 6, 0, 0.0, 0.0, -15.9, 9.0, 0.0, 0.0); 0878 term(1, 5, 0, -17.6, -29.3, 416.1, -250.0, 0.0, 0.0); 0879 term(1, 4, 0, -0.4, -0.7, 10.4, -6.2, 0.0, 0.0); 0880 term(2, 5, 0, -0.2, -0.4, 2.4, -1.4, 0.4, -0.3); 0881 0882 // perturbations by Saturn 0883 c[6] = 1.0; s[6] = 0.0; c[5] = cos(m6); s[5] = -sin(m6); 0884 addthe(c[5],s[5],c[5],s[5],c[4],s[4]); 0885 term(0, 5, 0, -0.1, 0.0, 0.2, -1.8, -0.1, -0.5); 0886 term(1, 6, 0, 0.0, 0.0, -8.3, -10.4, 0.0, 0.0); 0887 term(1, 5, 0, 13.6, -12.7, 187.5, 201.1, 0.0, 0.0); 0888 term(1, 4, 0, 0.4, -0.4, 4.5, 4.5, 0.0, 0.0); 0889 term(2, 5, 0, 0.4, -0.1, 1.7, -3.2, 0.2, 0.2); 0890 term(2, 4, 0, -0.1, 0.0, -0.2, 2.7, 0.0, 0.0); 0891 0892 // perturbations by Uranus 0893 c[6] = 1.0; s[6] = 0.0; c[5] = cos(m7); s[5] = -sin(m7); 0894 for (i=5; i>0; i--) 0895 addthe(c[i],s[i],c[5],s[5],c[i-1],s[i-1]); 0896 term(1, 6, 0, 32.3, 3549.5, -25880.2, 235.8, -6360.5, 374.0); 0897 term(1, 6, 1, 31.2, 34.4, -251.4, 227.4, 34.9, 29.3); 0898 term(1, 6, 2, -1.4, 3.9, -28.6, -10.1, 0.0, -0.9); 0899 term(2, 6, 0, 6.1, 68.0, -111.4, 2.0, -54.7, 3.7); 0900 term(2, 6, 1, 0.8, -0.2, -2.1, 2.0, -0.2, 0.8); 0901 term(3, 6, 0, 0.1, 1.0, -0.7, 0.0, -0.8, 0.1); 0902 term(0, 5, 0, -0.1, -0.3, -3.6, 0.0, 0.0, 0.0); 0903 term(1, 6, 0, 0.0, 0.0, 5.5, -6.9, 0.1, 0.0); 0904 term(1, 5, 0, -2.2, -1.6, -116.3, 163.6, 0.0, -0.1); 0905 term(1, 4, 0, 0.2, 0.1, -1.2, 0.4, 0.0, -0.1); 0906 term(2, 5, 0, 4.2, -1.1, -4.4, -34.6, -0.2, 0.1); 0907 term(2, 4, 0, 8.6, -2.9, -33.4, -97.0, 0.2, 0.1); 0908 term(3, 5, 0, 0.1, -0.2, 2.1, -1.2, 0.0, 0.1); 0909 term(3, 4, 0, -4.6, 9.3, 38.2, 19.8, 0.1, 0.1); 0910 term(3, 3, 0, -0.5, 1.7, 23.5, 7.0, 0.0, 0.0); 0911 term(4, 4, 0, 0.2, 0.8, 3.3, -1.5, -0.2, -0.1); 0912 term(4, 3, 0, 0.9, 1.7, 17.9, -9.1, -0.1, 0.0); 0913 term(4, 2, 0, -0.4, -0.4, -6.2, 4.8, 0.0, 0.0); 0914 term(5, 3, 0, -1.6, -0.5, -2.2, 7.0, 0.0, 0.0); 0915 term(5, 2, 0, -0.4, -0.1, -0.7, 5.5, 0.0, 0.0); 0916 term(5, 1, 0, 0.2, 0.0, 0.0, -3.5, 0.0, 0.0); 0917 term(6, 2, 0, -0.3, 0.2, 2.1, 2.7, 0.0, 0.0); 0918 term(6, 1, 0, 0.1, -0.1, -1.4, -1.4, 0.0, 0.0); 0919 term(6, 0, 0, -0.1, 0.1, 1.4, 0.7, 0.0, 0.0); 0920 0921 l = p2 * frac(0.1254046+m8/p2+((4982.8-21.3*t)*t+dl)/1296.0e3); 0922 b = (54.77+(0.26+0.06*t)*t+db)/arc; 0923 r = 30.072984+(0.001234+0.000003*t)*t+dr*1.0e-5; 0924 0925 dl = 1.04+0.02*cos(m8); dr = 0.27*sin(m8); db = 0.03*sin(m8); 0926 0927 posvel(); 0928 0929 return rp; 0930 } 0931 0932 /*--------------------- Pluto ------------------------------------------*/ 0933 0934 Vec3 Plan200::Pluto (double t) // position of Pluto at time t 0935 { 0936 /* 0937 Ecliptic coordinates rp (in A.U.) and velocity vp (in A.U./day) 0938 of Pluto for Equinox of Date. 0939 t is the time in Julian centuries since J2000. 0940 */ 0941 0942 const double arc = 206264.81; // 3600*180/pi = ''/r 0943 const double p2 = M_PI * 2.0; 0944 0945 int i; 0946 0947 tt = t; 0948 dl = 0.0; dr = 0.0; db = 0.0; 0949 m5 = p2 * frac(0.0565314+8.4302963*t); 0950 m6 = p2 * frac(0.8829867+3.3947688*t); 0951 m1 = p2 * frac(0.0385795+0.4026667*t); 0952 c3[0] = 1.0; s3[0] = 0.0; c3[1] = cos(m1); s3[1] = sin(m1); 0953 for (i=2; i<7; i++) 0954 addthe(c3[i-1],s3[i-1],c3[1],s3[1],c3[i],s3[i]); 0955 0956 // Kepler terms and perturbations by Jupiter 0957 c[3] = 1.0; s[3] = 0.0; c[4] = cos(m5); s[4] = sin(m5); 0958 for (i=3; i>1; i--) 0959 addthe(c[i],s[i],c[4],-s[4],c[i-1],s[i-1]); 0960 addthe(c[4],s[4],c[4],s[4],c[5],s[5]); 0961 term(1, 3, 0, 0.06,100924.08, -960396.0,15965.1, 51987.68,-24288.76); 0962 term(2, 3, 0, 3274.74,17835.12, -118252.2,3632.4, 12687.49,-6049.72); 0963 term(3, 3, 0, 1543.52,4631.99, -21446.6,1167.0, 3504.0,-1853.1); 0964 term(4, 3, 0, 688.99,1227.08, -4823.4,213.5, 1048.19,-648.26); 0965 term(5, 3, 0, 242.27, 415.93, -1075.4, 140.6, 302.33, -209.76); 0966 term(6, 3, 0, 138.41, 110.91, -308.8, -55.3, 109.52, -93.82); 0967 term(3, 2, 0, -0.99, 5.06, -25.6, 19.8, 1.26, -1.96); 0968 term(2, 2, 0, 7.15, 5.61, -96.7, 57.2, 1.64, -2.16); 0969 term(1, 2, 0, 10.79, 23.13, -390.4, 236.4, -0.33, 0.86); 0970 term(0, 4, 0, -0.23, 4.43, 102.8, 63.2, 3.15, 0.34); 0971 term(1, 4, 0, -1.1, -0.92, 11.8, -2.3, 0.43, 0.14); 0972 term(2, 4, 0, 0.62, 0.84, 2.3, 0.7, 0.05, -0.04); 0973 term(3, 4, 0, -0.38, -0.45, 1.2, -0.8, 0.04, 0.05); 0974 term(4, 4, 0, 0.17, 0.25, 0.0, 0.2, -0.01, -0.01); 0975 term(3, 1, 0, 0.06, 0.07, -0.6, 0.3, 0.03, -0.03); 0976 term(2, 1, 0, 0.13, 0.2, -2.2, 1.5, 0.03, -0.07); 0977 term(1, 1, 0, 0.32, 0.49, -9.4, 5.7, -0.01, 0.03); 0978 term(0, 1, 0, -0.04, -0.07, 2.6, -1.5, 0.07, -0.02); 0979 0980 // perturbations by Saturn 0981 c[4] = cos(m6); s[4] = sin(m6); 0982 for (i=3; i>1; i--) 0983 addthe(c[i],s[i],c[4],-s[4],c[i-1],s[i-1]); 0984 term(1, 2, 0, -29.47, 75.97, -106.4, -204.9, -40.71, -17.55); 0985 term(0, 4, 0, -13.88, 18.2, 42.6, -46.1, 1.13, 0.43); 0986 term(1, 4, 0, 5.81, -23.48, 15.0, -6.8, -7.48, 3.07); 0987 term(2, 4, 0, -10.27, 14.16, -7.9, 0.4, 2.43, -0.09); 0988 term(3, 4, 0, 6.86, -10.66, 7.3, -0.3, -2.25, 0.69); 0989 term(2, 1, 0, 4.23, 2.0, 0.0, -2.2, -0.24, 0.12); 0990 term(1, 1, 0, -5.04, -0.83, -9.2, -3.1, 0.79, -0.24); 0991 term(0, 1, 0, 4.25, 2.48, -5.9, -3.3, 0.58, 0.02); 0992 0993 // perturbations by Jupiter and Saturn 0994 double x, y; 0995 y = (m5-m6); x = cos(y); y = sin(y); 0996 dl = dl-9.11*x+0.12*y; dr = dr-3.4*x-3.3*y; db = db+0.81*x+0.78*y; 0997 addthe(x,y,c3[1],s3[1],x,y); 0998 dl = dl+5.92*x+0.25*y; dr = dr+2.3*x-3.8*y; db = db-0.67*x-0.51*y; 0999 1000 l = p2 * frac(0.6232469+m1/p2+dl/1296.0e3); 1001 b = -6.8232495189e-2 + db/arc; 1002 r = 40.7247248+dr*1.0e-5; 1003 1004 dl = 0.69+0.34*cos(m1)+0.12*cos(2*m1)+0.05*cos(3*m1); 1005 dr = 6.66*sin(m1)+1.64*sin(2*m1); 1006 db = -0.08*cos(m1)-0.17*sin(m1)-0.09*sin(2*m1); 1007 1008 // position 1009 double cl, sl, cb, sb; 1010 Mat3 mx; 1011 1012 cl = cos(l); sl = sin(l); cb = cos(b); sb = sin(b); 1013 rp[0] = r*cl*cb; rp[1] = r*sl*cb; rp[2] = r*sb; 1014 mx = pmatecl (-0.5000021, t); // 1950.0 -> Equinox of Date 1015 rp = mxvct (mx, rp); 1016 1017 // velocity 1018 vp[0] = (dr*cl*cb - dl*r*sl*cb - db*r*cl*sb) * 1E-4; 1019 vp[1] = (dr*sl*cb + dl*r*cl*cb - db*r*sl*sb) * 1E-4; 1020 vp[2] = (dr*sb + db*r*cb) * 1E-4; 1021 1022 return rp; 1023 } 1024 1025 /***************************************************************************/ 1026 /* ========================================================================= 1027 Procedures for calculating the positions of various moons in the 1028 solar system. The algorithms for the procedures of this unit are 1029 taken from the Explanatory Supplement to the Astronomical Almanac 1030 (edited by Kenneth Seidelmann, University Science Books, Mill Valley, 1031 California, 1992. A number of errors in chapter 6 of this book have 1032 been identified and corrected in the code used here. 1033 1034 Copyright :Gerhard HOLTKAMP 25-MAR-2014 1035 ========================================================================= */ 1036 1037 1038 /*--------------------- MarPhobos -----------------------------------------*/ 1039 void MarPhobos (double t, Vec3& rs, Vec3& vs) 1040 { 1041 /* 1042 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1043 of the Mars moon Phobos with respect to Mars for Equinox of Date. 1044 t is the time in Julian centuries since J2000. 1045 ====================================================================*/ 1046 1047 const double p2 = M_PI * 2.0; 1048 const double ax =6.26974E-5; 1049 const double nm = 1128.844556; 1050 const double ee = 0.0150; 1051 const double gam = 1.10*M_PI/180.0; 1052 1053 double thet, ll, pp, na, ja; 1054 double al, dy, yr; 1055 Mat3 mt1; 1056 1057 // time from 11-NOV-1971 1058 dy = t * 36525.0 + 10278.5; 1059 yr = dy / 365.25; 1060 1061 // normalized angles 1062 thet = p2 * frac ((327.9 - 0.43533*dy) / 360.0); 1063 ll = p2 * frac ((232.41 + nm*dy + 0.00124*yr*yr) / 360.0); 1064 pp = p2 * frac ((278.96 + 0.43526*dy) / 360.0); 1065 na = p2 * frac ((47.39 - 0.0014*yr) / 360.0); 1066 ja = p2 * frac ((37.27 + 0.0008*yr) / 360.0); 1067 1068 // in-orbit-plane position vector 1069 al = ll - pp; // mean anomaly 1070 al = eccanom (al, ee); // eccentric anomaly 1071 rs[0] = ax * (cos(al) - ee); 1072 rs[1] = ax * sqrt(1.0 - ee*ee) * sin(al); 1073 rs[2] = 0.0; 1074 1075 // in-orbit-plane velocity vector 1076 dy = cos(al); 1077 yr = 1.0 - ee*dy; 1078 yr = 1.235083014E-3 / yr; 1079 vs.assign(-yr*sin(al),yr*sqrt(1.0-ee*ee)*dy,0.0); 1080 1081 // convert to equatorial coordinates 1082 al = pp - thet - na; 1083 mt1 = zrot (-al); 1084 rs = mxvct (mt1, rs); 1085 vs = mxvct (mt1, vs); 1086 mt1 = xrot (-gam); 1087 rs = mxvct (mt1, rs); 1088 vs = mxvct (mt1, vs); 1089 mt1 = zrot (-thet); 1090 rs = mxvct (mt1, rs); 1091 vs = mxvct (mt1, vs); 1092 mt1 = xrot (-ja); 1093 rs = mxvct (mt1, rs); 1094 vs = mxvct (mt1, vs); 1095 mt1 = zrot (-na); 1096 rs = mxvct (mt1, rs); 1097 vs = mxvct (mt1, vs); 1098 1099 // convert to ecliptic coordinates of date 1100 mt1 = pmatequ (-0.500002096, t); 1101 rs = mxvct (mt1, rs); 1102 vs = mxvct (mt1, vs); 1103 rs = equecl (t, rs); 1104 vs = equecl (t, vs); 1105 1106 } 1107 1108 /*--------------------- MarDeimos ------------------------------------------*/ 1109 void MarDeimos (double t, Vec3& rs, Vec3& vs) 1110 { 1111 /* 1112 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1113 of the Mars moon Deimos with respect to Mars for Equinox of Date. 1114 t is the time in Julian centuries since J2000. 1115 ====================================================================== */ 1116 1117 const double p2 = M_PI * 2.0; 1118 const double ax =1.56828E-4; 1119 const double nm = 285.161888; 1120 const double ee = 0.0004; 1121 const double gam = 1.79*M_PI/180.0; 1122 1123 double thet, ll, pp, na, ja; 1124 double al, dy, yr; 1125 Mat3 mt1; 1126 1127 // time from 11-NOV-1971 1128 dy = t * 36525.0 + 10278.5; 1129 yr = dy / 365.25; 1130 1131 // normalized angles 1132 thet = p2 * frac ((240.38 - 0.01801*dy) / 360.0); 1133 ll = p2 * frac ((196.55 - 0.01801*dy) / 360.0); 1134 ll = p2 * frac ((28.96 + nm*dy - 0.27*sin(ll)) / 360.0); 1135 pp = p2 * frac ((111.7 + 0.01798*dy) / 360.0); 1136 na = p2 * frac ((46.37 - 0.0014*yr) / 360.0); 1137 ja = p2 * frac ((36.62 + 0.0008*yr) / 360.0); 1138 1139 // in-orbit- plane position vector 1140 al = ll - pp; // mean anomaly 1141 al = eccanom (al, ee); // eccentric anomaly 1142 rs[0] = ax * (cos(al) - ee); 1143 rs[1] = ax * sqrt(1.0 - ee*ee) * sin(al); 1144 rs[2] = 0.0; 1145 1146 // in-orbit-plane velocity vector 1147 dy = cos(al); 1148 yr = 1.0 - ee*dy; 1149 yr = 7.8046400669E-4 / yr; 1150 vs.assign(-yr*sin(al),yr*sqrt(1.0-ee*ee)*dy,0.0); 1151 1152 // convert to equatorial coordinates 1153 al = pp - thet - na; 1154 mt1 = zrot (-al); 1155 rs = mxvct (mt1, rs); 1156 vs = mxvct (mt1, vs); 1157 mt1 = xrot (-gam); 1158 rs = mxvct (mt1, rs); 1159 vs = mxvct (mt1, vs); 1160 mt1 = zrot (-thet); 1161 rs = mxvct (mt1, rs); 1162 vs = mxvct (mt1, vs); 1163 mt1 = xrot (-ja); 1164 rs = mxvct (mt1, rs); 1165 vs = mxvct (mt1, vs); 1166 mt1 = zrot (-na); 1167 rs = mxvct (mt1, rs); 1168 vs = mxvct (mt1, vs); 1169 1170 // convert to ecliptic coordinates of date 1171 mt1 = pmatequ (-0.500002096, t); 1172 rs = mxvct (mt1, rs); 1173 vs = mxvct (mt1, vs); 1174 rs = equecl (t, rs); 1175 vs = equecl (t, vs); 1176 1177 } 1178 1179 /*--------------------- PosJIo ------------------------------------------*/ 1180 Vec3 PosJIo (double t) 1181 { 1182 /* ---------------------------------------------------------------------- } 1183 Ecliptic coordinates (in A.U.) rs 1184 of Io with respect to Jupiter for Equinox of Date. 1185 t is the time in Julian centuries since J2000. 1186 ======================================================================*/ 1187 1188 const double pi2 = M_PI * 2.0; 1189 const double ax = 0.002819347; 1190 const double omj = 99.99754*M_PI/180.0; 1191 const double jj = 1.30691*M_PI/180.0; 1192 const double ii = 3.10401*M_PI/180.0; 1193 1194 double l1, l2, phl, p1, p2, p3, p4; 1195 double pij, th1, th2, psi, gg; 1196 double xi, nu, ze; 1197 double d; // : EXTENDED; 1198 Vec3 rs; 1199 Mat3 mt1; 1200 1201 // general jupiter moon data 1202 d = t*36525.0 + 8544.5; 1203 l1 = pi2 * frac((106.07859 + 203.4889553630643*d)/360.0); 1204 l2 = pi2 * frac((175.733787 + 101.3747245566245*d)/360.0); 1205 phl = pi2* frac((184.415351 + 0.17356902*d)/360.0); 1206 p1 = pi2 * frac((82.380231 + 0.16102275*d)/360.0); 1207 p2 = pi2 * frac((128.960393 + 0.04645644*d)/360.0); 1208 p3 = pi2 * frac((187.550171 + 0.00712408*d)/360.0); 1209 p4 = pi2 * frac((335.309254 + 0.00183939*d)/360.0); 1210 pij = 0.23510274429; // 13.470395 1211 th1 = pi2* frac((308.365749 - 0.1328061*d)/360.0); 1212 th2 = pi2* frac((100.438938 - 0.03261535*d)/360.0); 1213 psi = pi2* frac((316.500101 - 0.00000248*d)/360.0); 1214 gg = pi2 * frac((30.2380210168 + 0.08309256178969453*d)/360.0); 1215 1216 // io specific lines 1217 xi = -41279.0 * cos(2.0*(l1-l2))*1E-7; 1218 nu = -5596.0*sin(p3-p4) - 2198.0*sin(p1+p2-2.0*(pij+gg)) 1219 +1321.0*sin(phl) - 1157.0*sin(l1-2.0*l2+p4) 1220 -1940.0*sin(l1-2.0*l2+p3) + 791.0*sin(l1-2.0*l2+p2) 1221 + 82363.0*sin(2.0*(l1-l2)); 1222 nu *= 1E-7; 1223 ze = 7038.0*sin(l1-th1+nu) + 1835.0*sin(l1-th2+nu); 1224 ze *= 1E-7; 1225 1226 // convert to rectangular coordinates in Jovian equatorial 1227 1228 rs.assign (ax * (1+xi) * cos(l1-psi+nu), 1229 ax * (1+xi) * sin(l1-psi+nu), 1230 ax * ze); 1231 1232 // convert into ecliptic of 1950.0 1233 mt1 = xrot (-ii); 1234 rs = mxvct (mt1, rs); 1235 mt1 = zrot (-(psi-omj)); 1236 rs = mxvct (mt1, rs); 1237 mt1 = xrot (-jj); 1238 rs = mxvct (mt1, rs); 1239 mt1 = zrot (-omj); 1240 rs = mxvct (mt1, rs); 1241 1242 // convert into ecliptic of date 1243 mt1 = pmatecl (-0.500002096, t); 1244 rs = mxvct (mt1, rs); 1245 1246 return rs; 1247 1248 } 1249 1250 /*--------------------- PosEuropa ------------------------------------------*/ 1251 Vec3 PosEuropa (double t) 1252 { 1253 /* 1254 Ecliptic coordinates (in A.U.) rs 1255 of Europa with respect to Jupiter for Equinox of Date. 1256 t is the time in Julian centuries since J2000. 1257 =====================================================================*/ 1258 1259 const double pi2 = M_PI * 2.0; 1260 const double ax = 0.004485872; 1261 const double omj = 99.99754*M_PI/180.0; 1262 const double jj = 1.30691*M_PI/180.0; 1263 const double ii = 3.10401*M_PI/180.0; 1264 1265 double l1, l2, l3, phl, p2, p3, p4; 1266 double pij, th2, th3, psi, gg; 1267 double xi, nu, ze; 1268 double d; // : EXTENDED; 1269 Vec3 rs; 1270 Mat3 mt1; 1271 1272 1273 // general jupiter moon data 1274 d = t*36525.0 + 8544.5; 1275 l1 = pi2 * frac((106.07859 + 203.4889553630643*d)/360.0); 1276 l2 = pi2 * frac((175.733787 + 101.3747245566245*d)/360.0); 1277 l3 = pi2 * frac((120.5613855 + 50.31760915340462*d)/360.0); 1278 phl = pi2* frac((184.415351 + 0.17356902*d)/360.0); 1279 // p1 = pi2 * frac((82.380231 + 0.16102275*d)/360.0); 1280 p2 = pi2 * frac((128.960393 + 0.04645644*d)/360.0); 1281 p3 = pi2 * frac((187.550171 + 0.00712408*d)/360.0); 1282 p4 = pi2 * frac((335.309254 + 0.00183939*d)/360.0); 1283 pij = 0.23510274429; // 13.470395 1284 th2 = pi2* frac((100.438938 - 0.03261535*d)/360.0); 1285 th3 = pi2* frac((118.908928 - 0.00717678*d)/360.0); 1286 psi = pi2* frac((316.500101 - 0.00000248*d)/360.0); 1287 gg = pi2 * frac((30.2380210168 + 0.08309256178969453*d)/360.0); 1288 1289 // Europa specific lines 1290 xi = -3187*cos(l2-p3) - 1738*cos(l2-p4) 1291 +93748*cos(l1-l2); 1292 xi *= 1E-7; 1293 nu = -1158*sin(2*(psi-pij)) + 1715*sin(-2*(pij+gg)+th3+psi) 1294 -1846*sin(gg) + 2397*sin(p3-p4) - 3172*sin(phl) 1295 -1993*sin(l2-l3) + 1844*sin(l2-p2) 1296 +6394*sin(l2-p3) + 3451*sin(l2-p4) 1297 +4159*sin(l1-2*l2+p4) + 7571*sin(l1-2*l2+p3) 1298 -1491*sin(l1-2*l2+p3) - 185640*sin(l1-l2) 1299 -803*sin(l1-l3) + 915*sin(2*(l1-l2)); 1300 nu *= 1E-7; 1301 ze = 81575*sin(l2-th2+nu) + 4512*sin(l2-th3+nu) 1302 -3286*sin(l2-psi+nu); 1303 ze *= 1E-7; 1304 1305 // convert to rectangular coordinates in Jovian equatorial 1306 1307 rs.assign (ax * (1+xi) * cos(l2-psi+nu), 1308 ax * (1+xi) * sin(l2-psi+nu), 1309 ax * ze); 1310 1311 // convert into ecliptic of 1950.0 1312 1313 mt1 = xrot (-ii); 1314 rs = mxvct (mt1, rs); 1315 mt1 = zrot (-(psi-omj)); 1316 rs = mxvct (mt1, rs); 1317 mt1 = xrot (-jj); 1318 rs = mxvct (mt1, rs); 1319 mt1 = zrot (-omj); 1320 rs = mxvct (mt1, rs); 1321 1322 // convert into ecliptic of date 1323 mt1 = pmatecl (-0.500002096, t); 1324 rs = mxvct (mt1, rs); 1325 1326 return rs; 1327 1328 } 1329 1330 /*--------------------- PosGanymede --------------------------------------*/ 1331 Vec3 PosGanymede (double t) 1332 { 1333 /* 1334 Ecliptic coordinates (in A.U.) 1335 of Ganymede with respect to Jupiter for Equinox of Date. 1336 t is the time in Julian centuries since J2000. 1337 =====================================================================*/ 1338 1339 const double pi2 = M_PI * 2.0; 1340 const double ax = 0.007155352; 1341 const double omj = 99.99754*M_PI/180.0; 1342 const double jj = 1.30691*M_PI/180.0; 1343 const double ii = 3.10401*M_PI/180.0; 1344 1345 double l1, l2, l3, l4, phl, p1, p2, p3, p4; 1346 double pij, th2, th3, th4, psi, gg; 1347 double xi, nu, ze; 1348 double d; // : EXTENDED; 1349 Vec3 rs; 1350 Mat3 mt1; 1351 1352 // general jupiter moon data 1353 d = t*36525.0 + 8544.5; 1354 l1 = pi2 * frac((106.07859 + 203.4889553630643*d)/360.0); 1355 l2 = pi2 * frac((175.733787 + 101.3747245566245*d)/360.0); 1356 l3 = pi2 * frac((120.5613855 + 50.31760915340462*d)/360.0); 1357 l4 = pi2 * frac((84.455823 + 21.57107087517961*d)/360.0); 1358 phl = pi2* frac((184.415351 + 0.17356902*d)/360.0); 1359 p1 = pi2 * frac((82.380231 + 0.16102275*d)/360.0); 1360 p2 = pi2 * frac((128.960393 + 0.04645644*d)/360.0); 1361 p3 = pi2 * frac((187.550171 + 0.00712408*d)/360.0); 1362 p4 = pi2 * frac((335.309254 + 0.00183939*d)/360.0); 1363 pij = 0.23510274429; // 13.470395 1364 th2 = pi2* frac((100.438938 - 0.03261535*d)/360.0); 1365 th3 = pi2* frac((118.908928 - 0.00717678*d)/360.0); 1366 th4 = pi2* frac((322.746564 - 0.00176018*d)/360.0); 1367 psi = pi2* frac((316.500101 - 0.00000248*d)/360.0); 1368 gg = pi2 * frac((30.2380210168 + 0.08309256178969453*d)/360.0); 1369 1370 // Ganymede specific lines 1371 xi = -14691*cos(l3-p3) - 1758*cos(2*(l3-l4)) 1372 +6333*cos(l2-l3); 1373 xi *= 1E-7; 1374 nu = -1488*sin(2*(pij+psi)) + 411*sin(-th3+psi) 1375 +346*sin(-th4+psi) - 2338*sin(gg) 1376 +6558*sin(p3-p4) + 523*sin(p1+p3-2*(pij+gg)) 1377 +341*sin(phl) - 943*sin(l3-l4) 1378 +29387*sin(l3-p3) + 15800*sin(l3-p4) 1379 +3218*sin(2*(l3-l4)) + 226*sin(3*l3-2*l4) 1380 -12038*sin(l2-l3) - 662*sin(l1-2*l2+p4) 1381 -1246*sin(l1-2*l2+p3) + 699*sin(l1-2*l2+p2) 1382 +217*sin(l1-l3); 1383 nu *= 1E-7; 1384 ze = -2793*sin(l3-th2+nu) + 32387*sin(l3-th3+nu) 1385 +6871*sin(l3-th4+nu) - 16876*sin(l3-psi+nu); 1386 ze *= 1E-7; 1387 1388 // convert to rectangular coordinates in Jovian equatorial 1389 1390 rs.assign (ax * (1+xi) * cos(l3-psi+nu), 1391 ax * (1+xi) * sin(l3-psi+nu), 1392 ax * ze); 1393 1394 // convert into ecliptic of 1950.0 1395 1396 mt1 = xrot (-ii); 1397 rs = mxvct (mt1, rs); 1398 mt1 = zrot (-(psi-omj)); 1399 rs = mxvct (mt1, rs); 1400 mt1 = xrot (-jj); 1401 rs = mxvct (mt1, rs); 1402 mt1 = zrot (-omj); 1403 rs = mxvct (mt1, rs); 1404 1405 // convert into ecliptic of date 1406 mt1 = pmatecl (-0.500002096, t); 1407 rs = mxvct (mt1, rs); 1408 1409 return rs; 1410 1411 } 1412 1413 /*--------------------- PosCallisto --------------------------------------*/ 1414 Vec3 PosCallisto (double t) 1415 { 1416 /* 1417 Ecliptic coordinates (in A.U.) 1418 of Callisto with respect to Jupiter for Equinox of Date. 1419 t is the time in Julian centuries since J2000. 1420 =====================================================================*/ 1421 1422 const double pi2 = M_PI * 2.0; 1423 const double ax = 0.012585436; 1424 const double omj = 99.99754*M_PI/180.0; 1425 const double jj = 1.30691*M_PI/180.0; 1426 const double ii = 3.10401*M_PI/180.0; 1427 1428 double l3, l4, p3, p4; 1429 double pij, th3, th4, psi, gp, gg, ph2; 1430 double xi, nu, ze; 1431 double d; // : EXTENDED; 1432 Vec3 rs; 1433 Mat3 mt1; 1434 1435 // general jupiter moon data 1436 d = t*36525.0 + 8544.5; 1437 l3 = pi2 * frac((120.5613855 + 50.31760915340462*d)/360.0); 1438 l4 = pi2 * frac((84.455823 + 21.57107087517961*d)/360.0); 1439 // phl = pi2* frac((184.415351 + 0.17356902*d)/360.0); 1440 p3 = pi2 * frac((187.550171 + 0.00712408*d)/360.0); 1441 p4 = pi2 * frac((335.309254 + 0.00183939*d)/360.0); 1442 pij = 0.23510274429; // 13.470395 1443 th3 = pi2* frac((118.908928 - 0.00717678*d)/360.0); 1444 th4 = pi2* frac((322.746564 - 0.00176018*d)/360.0); 1445 psi = pi2* frac((316.500101 - 0.00000248*d)/360.0); 1446 gp = pi2 * frac((31.9785280244 + 0.033459733896*d)/360.0); 1447 gg = pi2 * frac((30.2380210168 + 0.08309256178969453*d)/360.0); 1448 ph2 = 0.91009489942; // 52.1445966929 1449 1450 // Callisto specific lines 1451 xi = 1656*cos(l4-p3) - 73328*cos(l4-p4) 1452 +182*cos(l4-pij) - 541*cos(l4+p4-2*(pij+gg)) 1453 -269*cos(2*(l4-p4)) + 974*cos(l3-l4); 1454 xi *= 1E-7; 1455 nu = -407*sin(2*(psi-p4)) + 309*sin(-2*p4+th4+psi) 1456 -4840*sin(2*(psi-pij)) + 2074*sin(-th4+psi) 1457 -5605*sin(gg) - 204*sin(2*gg) 1458 -495*sin(5*gp-2*gg+ph2) + 234*sin(p4-pij) 1459 -6112*sin(p3-p4) - 3318*sin(l4-p3) 1460 +145573*sin(l4-p4) + 178*sin(l4-pij-gg) 1461 -363*sin(l4-pij) + 1085*sin(l4+p4-2*(pij+gg)) 1462 +672*sin(2*(l4-p4)) + 218*sin(2*(l4-pij-gg)) 1463 +167*sin(2*l4-th4-psi) - 142*sin(2*(l4-psi)) 1464 +148*sin(l3-2*l4+p4) - 390*sin(l3-l4) 1465 -195*sin(2*(l3-l4)) + 185*sin(3*l3-7*l4+4*p4); 1466 nu *= 1E-7; 1467 ze = 773*sin(l4-2*(pij+gg)+psi+nu) 1468 -5075*sin(l4-th3+nu) + 44300*sin(l4-th4+nu) 1469 -76493*sin(l4-psi+nu); 1470 ze *= 1E-7; 1471 1472 rs.assign(ax * (1+xi) * cos(l4-psi+nu), 1473 ax * (1+xi) * sin(l4-psi+nu), 1474 ax * ze); 1475 1476 // convert into ecliptic of 1950.0 1477 1478 mt1 = xrot (-ii); 1479 rs = mxvct (mt1, rs); 1480 mt1 = zrot (-(psi-omj)); 1481 rs = mxvct (mt1, rs); 1482 mt1 = xrot (-jj); 1483 rs = mxvct (mt1, rs); 1484 mt1 = zrot (-omj); 1485 rs = mxvct (mt1, rs); 1486 1487 // convert into ecliptic of date 1488 mt1 = pmatecl (-0.500002096, t); 1489 rs = mxvct (mt1, rs); 1490 1491 return rs; 1492 1493 } 1494 1495 /*-------------------- Mimas, Enceladus, Dione ---------------------*/ 1496 Vec3 PosSMimas (double t) 1497 { 1498 /* Ecliptic coordinates (in A.U.) of Mimas with respect to Saturn 1499 for Equinox of Date. 1500 t is the time in Julian centuries since J2000. 1501 ===================================================================*/ 1502 const double ie = 28.0771*M_PI/180.0; 1503 const double oe = 168.8263*M_PI/180.0; 1504 1505 double d, dt, tt, a, n, ecc, gam, th1, l1, p, m; 1506 Vec3 rs; 1507 Mat3 mt1; 1508 1509 d = 36525.0*t + 40452.0; 1510 dt = d / 365.25; 1511 tt = 5.0616*(((36525*t + 18262.577000)/365.25)+1950.0-1866.06); 1512 tt *= M_PI / 180.0; 1513 a = 0.00124171; 1514 n = 381.994516; 1515 ecc = 0.01986; 1516 gam = 0.0274017; // 1.570; 1517 th1 = 49.4 - 365.025*dt; 1518 l1 = 128.839 + n*d - 43.415*sin(tt) - 0.714*sin(3.0*tt) - 0.020*sin(5.0*tt); 1519 p = 107.0 + 365.560*dt; 1520 1521 // in-orbit-plane position vector 1522 m = l1 - p; // mean anomaly 1523 m = m * M_PI / 180.0; 1524 m = eccanom (m, ecc); // eccentric anomaly 1525 rs.assign (a*(cos(m) - ecc), a*sqrt(1.0 - ecc*ecc)*sin(m), 0); 1526 1527 // convert to ecliptic coordinates 1528 m = p - th1; 1529 m = m * M_PI / 180.0; 1530 mt1 = zrot (-m); 1531 rs = mxvct (mt1, rs); 1532 mt1 = xrot (-gam); 1533 rs = mxvct (mt1, rs); 1534 m = th1*M_PI/180.0 - oe; 1535 mt1 = zrot (-m); 1536 rs = mxvct (mt1, rs); 1537 mt1 = xrot (-ie); 1538 rs = mxvct (mt1, rs); 1539 mt1 = zrot (-oe); 1540 rs = mxvct (mt1, rs); 1541 1542 // convert to ecliptic coordinates of date 1543 mt1 = pmatecl (-0.500002096, t); 1544 rs = mxvct (mt1, rs); 1545 1546 return rs; 1547 } 1548 1549 Vec3 PosSEnceladus (double t) 1550 { 1551 /* Ecliptic coordinates (in A.U.) of Enceladus with respect to Saturn 1552 for Equinox of Date. 1553 t is the time in Julian centuries since J2000. 1554 ===================================================================*/ 1555 const double ie = 28.0771*M_PI/180.0; 1556 const double oe = 168.8263*M_PI/180.0; 1557 1558 double d, dt, /*tt,*/ a, n, ecc, gam, th1, l1, p, m; 1559 Vec3 rs; 1560 Mat3 mt1; 1561 1562 d = 36525.0*t + 40452.0; 1563 dt = d / 365.25; 1564 a = 0.00158935; 1565 n = 262.7319052; 1566 ecc = 0.00532; 1567 gam = 0.000628319; // 0.036; 1568 th1 = 145.0 - 152.7*dt; 1569 l1 = 200.155 + n*d + 0.256333 * sin((59.4+32.73*dt)*M_PI/180.0) 1570 + 0.217333 * sin((119.2+93.18*dt)*M_PI/180.0); 1571 p = 312.7 + 123.42*dt; 1572 1573 // in-orbit-plane position vector 1574 m = l1 - p; // mean anomaly 1575 m = m * M_PI / 180.0; 1576 m = eccanom (m, ecc); // eccentric anomaly 1577 rs.assign (a*(cos(m) - ecc), a*sqrt(1.0 - ecc*ecc)*sin(m), 0); 1578 1579 // convert to ecliptic coordinates 1580 m = p - th1; 1581 m = m * M_PI / 180.0; 1582 mt1 = zrot (-m); 1583 rs = mxvct (mt1, rs); 1584 mt1 = xrot (-gam); 1585 rs = mxvct (mt1, rs); 1586 m = th1*M_PI/180.0 - oe; 1587 mt1 = zrot (-m); 1588 rs = mxvct (mt1, rs); 1589 mt1 = xrot (-ie); 1590 rs = mxvct (mt1, rs); 1591 mt1 = zrot (-oe); 1592 rs = mxvct (mt1, rs); 1593 1594 // convert to ecliptic coordinates of date 1595 mt1 = pmatecl (-0.500002096, t); 1596 rs = mxvct (mt1, rs); 1597 1598 return rs; 1599 } 1600 1601 Vec3 PosSDione (double t) 1602 { 1603 /* Ecliptic coordinates (in A.U.) of Dione with respect to Saturn 1604 for Equinox of Date. 1605 t is the time in Julian centuries since J2000. 1606 ===================================================================*/ 1607 1608 const double ie = 28.0771*M_PI/180.0; 1609 const double oe = 168.8263*M_PI/180.0; 1610 1611 double d, dt, /*tt,*/ a, n, ecc, gam, th1, l1, p, m; 1612 Vec3 rs; 1613 Mat3 mt1; 1614 1615 d = 36525.0*t + 40452.0; 1616 dt = d / 365.25; 1617 a = 0.00252413; 1618 n = 131.534920026; 1619 ecc = 0.001715; 1620 gam = 0.0005044; // 0.0289; 1621 th1 = 228.0 - 30.6197 * dt; 1622 l1 = 255.1183 + n*d - 0.0146667 * sin((59.4+32.73*dt)*M_PI/180.0) 1623 - 0.0125 * sin((119.2+93.18*dt)*M_PI/180.0); 1624 p = 173.6 + 30.8381 * dt; 1625 1626 // in-orbit-plane position vector 1627 m = l1 - p; // mean anomaly 1628 m = m * M_PI / 180.0; 1629 m = eccanom (m, ecc); // eccentric anomaly 1630 rs.assign (a*(cos(m) - ecc), a*sqrt(1.0 - ecc*ecc)*sin(m), 0); 1631 1632 // convert to ecliptic coordinates 1633 m = p - th1; 1634 m = m * M_PI / 180.0; 1635 mt1 = zrot (-m); 1636 rs = mxvct (mt1, rs); 1637 mt1 = xrot (-gam); 1638 rs = mxvct (mt1, rs); 1639 m = th1*M_PI/180.0 - oe; 1640 mt1 = zrot (-m); 1641 rs = mxvct (mt1, rs); 1642 mt1 = xrot (-ie); 1643 rs = mxvct (mt1, rs); 1644 mt1 = zrot (-oe); 1645 rs = mxvct (mt1, rs); 1646 1647 // convert to ecliptic coordinates of date 1648 mt1 = pmatecl (-0.500002096, t); 1649 rs = mxvct (mt1, rs); 1650 1651 return rs; 1652 } 1653 1654 /*--------------------- JupIo --------------------------------------*/ 1655 void JupIo (double t, Vec3& rs, Vec3& vs) 1656 { 1657 /* 1658 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1659 of Io with respect to Jupiter for Equinox of Date. 1660 t is the time in Julian centuries since J2000. 1661 ====================================================================*/ 1662 1663 const double dlt = 3.472222E-4; // 30 sec 1664 1665 double td; 1666 1667 td = dlt / 36525; 1668 rs = PosJIo (t-td); 1669 vs = PosJIo (t+td); 1670 vs -= rs; 1671 td = 0.5/dlt; 1672 vs *= td; 1673 rs = PosJIo (t); 1674 1675 } 1676 1677 /*--------------------- JupEuropa --------------------------------------*/ 1678 void JupEuropa (double t, Vec3& rs, Vec3& vs) 1679 { 1680 /* 1681 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1682 of Europa with respect to Jupiter for Equinox of Date. 1683 t is the time in Julian centuries since J2000. 1684 ====================================================================*/ 1685 1686 const double dlt = 3.472222E-4; // 30 sec 1687 1688 double td; 1689 1690 td = dlt / 36525; 1691 rs = PosEuropa (t-td); 1692 vs = PosEuropa (t+td); 1693 vs -= rs; 1694 td = 0.5/dlt; 1695 vs *= td; 1696 rs = PosEuropa (t); 1697 1698 } 1699 1700 /*--------------------- JupGanymede ------------------------------------*/ 1701 void JupGanymede (double t, Vec3& rs, Vec3& vs) 1702 { 1703 /* 1704 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1705 of Ganimede with respect to Jupiter for Equinox of Date. 1706 t is the time in Julian centuries since J2000. 1707 ====================================================================*/ 1708 1709 const double dlt = 3.472222E-4; // 30 sec 1710 1711 double td; 1712 1713 td = dlt / 36525; 1714 rs = PosGanymede (t-td); 1715 vs = PosGanymede (t+td); 1716 vs -= rs; 1717 td = 0.5/dlt; 1718 vs *= td; 1719 rs = PosGanymede (t); 1720 1721 } 1722 1723 /*--------------------- JupCallisto ------------------------------------*/ 1724 void JupCallisto (double t, Vec3& rs, Vec3& vs) 1725 { 1726 /* 1727 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1728 of Callisto with respect to Jupiter for Equinox of Date. 1729 t is the time in Julian centuries since J2000. 1730 ====================================================================*/ 1731 1732 const double dlt = 3.472222E-4; // 30 sec 1733 1734 double td; 1735 1736 td = dlt / 36525; 1737 rs = PosCallisto (t-td); 1738 vs = PosCallisto (t+td); 1739 vs -= rs; 1740 td = 0.5/dlt; 1741 vs *= td; 1742 rs = PosCallisto (t); 1743 1744 } 1745 1746 /*----------------------- SatRhea ------------------------------------*/ 1747 void SatRhea (double t, Vec3& rs, Vec3& vs) 1748 { 1749 /* 1750 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1751 of Rhea with respect to Saturn for Equinox of Date. 1752 t is the time in Julian centuries since J2000. 1753 ====================================================================*/ 1754 1755 const double pi2 = M_PI * 2.0; 1756 const double ie = 28.0771*M_PI/180.0; 1757 const double oe = 168.8263*M_PI/180.0; 1758 const double kap = 57.29578*M_PI/180.0; 1759 const double ax = 0.003524; 1760 const double sg0 = 5.7682811893E-3; // sin(0.3305) 1761 1762 double d, td, tt, pp, ot, nt; 1763 double lam, ii, omg, omb, ee; 1764 Mat3 mt1; 1765 1766 // various times 1767 tt = t*36525.0; 1768 d = tt + 40452.0; 1769 td = 0.5219*(tt+40177)/365.25; 1770 tt = d / 365.25; 1771 1772 // Titan perturbations 1773 pp = pi2 * frac((305.0 + 10.2077*tt)/360.0); 1774 ot = pi2 * frac((276.49 + td)/360.0); 1775 nt = pi2 * frac((44.5 - td)/360.0); 1776 1777 // osculating orbit elements 1778 ee = 0.00021*sin(pp) + 0.001*sin(ot); 1779 omg = 0.00021*cos(pp) + 0.001*cos(ot); 1780 omb = atan2(ee,omg); 1781 ii = sin(omb); 1782 if (fabs(ii) > 0.5) ee = fabs(ee/ii); 1783 else ee = fabs(omg/cos(omb)); 1784 pp = pi2 * frac((356.87 - 10.2077*tt)/360.0); 1785 ot = sin(pp); 1786 lam = pi2 * frac((359.4727 + 79.69004007*d)/360.0); 1787 lam = lam + kap*sg0*tan(0.5*ie)*ot; 1788 ii = ie - 7.9412480966E-4 + kap*sg0*cos(pp) 1789 + 3.5081117965E-4*cos(nt); 1790 omg = oe - 1.3613568166E-4 1791 + (kap*sg0*ot + 3.5081117965E-4*sin(nt))/sin(ie); 1792 1793 // in-orbit-plane position vector 1794 pp = lam - omb; // mean anomaly 1795 pp = eccanom (pp, ee); // eccentric anomaly 1796 rs.assign (ax * (cos(pp) - ee), ax * sqrt(1.0 - ee*ee) * sin(pp), 0); 1797 1798 // in-orbit-plane velocity vector 1799 d = cos(pp); 1800 td = 1.0 - ee*d; 1801 td = 4.9000413575E-3 / td; 1802 vs.assign (-td*sin(pp), td*sqrt(1.0-ee*ee)*d, 0); 1803 1804 // convert to ecliptic coordinates 1805 pp = omb - omg; 1806 mt1 = zrot (-pp); 1807 rs = mxvct (mt1, rs); 1808 vs = mxvct (mt1, vs); 1809 mt1 = xrot (-ii); 1810 rs = mxvct (mt1, rs); 1811 vs = mxvct (mt1, vs); 1812 mt1 = zrot (-omg); 1813 rs = mxvct (mt1, rs); 1814 vs = mxvct (mt1, vs); 1815 1816 // convert to ecliptic coordinates of date 1817 mt1 = pmatecl (-0.500002096, t); 1818 rs = mxvct (mt1, rs); 1819 vs = mxvct (mt1, vs); 1820 1821 } 1822 1823 /*----------------------- SatTitan ------------------------------------*/ 1824 void SatTitan (double t, Vec3& rs, Vec3& vs) 1825 { 1826 /* 1827 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1828 of Titan with respect to Saturn for Equinox of Date. 1829 t is the time in Julian centuries since J2000. 1830 ===================================================================*/ 1831 1832 const double pi2 = M_PI * 2.0; 1833 const double ie = 28.0771*M_PI/180.0; 1834 const double oe = 168.8263*M_PI/180.0; 1835 const double kap = 57.29578*M_PI/180.0; 1836 const double ax = 0.00816765; 1837 const double sg0 = 5.7682811893E-3; // sin(0.3305) 1838 1839 double d, tt, ts, gg, ls, is, os, lms, psi; 1840 double lam, ii, omg, omb, ee, s4; 1841 Mat3 mt1; 1842 1843 // various times 1844 ts = t + 1.0; 1845 tt = t*36525.0; 1846 d = tt+40177; 1847 tt = d / 365.25; 1848 1849 // solar perturbations 1850 ls = pi2 * frac((175.4762 + 1221.5515*ts)/360.0); 1851 is = pi2 * frac((2.4891 + 0.002435*ts)/360.0); 1852 os = pi2 * frac((113.35 - 0.2597*ts)/360.0); 1853 lms = pi2* frac((267.2635 + 1222.1136*ts)/360.0); 1854 1855 gg = pi2 * frac((41.28 - 0.5219*tt)/360.0); 1856 ii = ie - 1.0828022679E-2 + kap*5.2185107774E-3*cos(gg); 1857 s4 = sin(gg); 1858 omg = oe - 2.4748768793E-3 + kap*5.2185107774E-3*s4/sin(ie); 1859 omb = pi2 * frac((275.837 + 0.5219*tt)/360.0); 1860 1861 psi = sin(is)*sin(omg-os); 1862 gg = cos(omg-os); 1863 ts = cos(is)*sin(ii) - sin(is)*cos(ii)*gg; 1864 psi = atan2(psi,ts); 1865 ts = cos(is)*sin(ii)*gg - sin(is)*cos(ii); 1866 gg = sin(ii)*sin(omg-os); 1867 gg = atan2(gg,ts); 1868 lms = lms - gg - os; 1869 gg = omb - omg - psi; 1870 1871 // osculating orbit elements 1872 ts = 2*(lms-gg); 1873 ee = 0.028815 - 0.000184*cos(2*gg) + 0.000073*cos(ts); 1874 omb = omb + kap*(0.00630*sin(2*gg) + 0.0025*sin(ts)); 1875 gg = 2*lms + psi; 1876 lam = pi2 * frac((261.3121 + 22.57697385*d)/360.0) 1877 +kap*(sg0*tan(0.5*ie)*s4 - 0.000176*sin(ls) 1878 -0.000215*sin(2*lms) + 0.000057*sin(gg)); 1879 ii = ii + 0.000232*kap*cos(gg); 1880 omg = omg + 0.000503*kap*sin(gg); 1881 1882 // in-orbit-plane position vector 1883 gg = lam - omb; // mean anomaly 1884 if (gg < 0) gg += pi2; 1885 gg = eccanom (gg, ee); // eccentric anomaly 1886 rs.assign (ax * (cos(gg) - ee), ax * sqrt(1.0 - ee*ee) * sin(gg), 0); 1887 1888 // in-orbit-plane velocity vector 1889 d = cos(gg); 1890 ts = 1.0 - ee*d; 1891 ts = 3.2183196288E-3 / ts; 1892 vs.assign (-ts*sin(gg), ts*sqrt(1.0-ee*ee)*d, 0); 1893 1894 // convert to ecliptic coordinates 1895 gg = omb - omg; 1896 mt1 = zrot (-gg); 1897 rs = mxvct (mt1, rs); 1898 vs = mxvct (mt1, vs); 1899 mt1 = xrot (-ii); 1900 rs = mxvct (mt1, rs); 1901 vs = mxvct (mt1, vs); 1902 mt1 = zrot (-omg); 1903 rs = mxvct (mt1, rs); 1904 vs = mxvct (mt1, vs); 1905 1906 // convert to ecliptic coordinates of date 1907 mt1 = pmatecl (-0.500002096, t); 1908 rs = mxvct (mt1, rs); 1909 vs = mxvct (mt1, vs); 1910 1911 } 1912 1913 1914 /*----------------------- NepTriton ------------------------------------*/ 1915 void NepTriton (double t, Vec3& rs, Vec3& vs) 1916 { 1917 /* 1918 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1919 of Triton with respect to Neptune for Equinox of Date. 1920 t is the time in Julian centuries since J2000. 1921 ====================================================================*/ 1922 1923 const double pi2 = M_PI * 2.0; 1924 const double ax = 0.00237142; 1925 const double gam = 158.996*M_PI/180.0; 1926 1927 double d, nn, u, jj, ap; 1928 Mat3 mt1; 1929 1930 // days since epoch 1931 d = t*36525 + 18262.5; 1932 1933 // pole of fixed plane in 1950.0 1934 nn = pi2 * frac((359.28 + 54.308*t)/360.0); 1935 rs.assign (1.0, 1936 pi2 * frac((298.72+2.58*sin(nn)-0.04*sin(2*nn))/360.0), 1937 pi2 * frac((42.63-1.9*cos(nn)+0.01*cos(2*nn))/360.0)); 1938 rs = polcar (rs); 1939 mt1 = pmatequ (0.0, -0.500002096); 1940 rs = mxvct (mt1, rs); 1941 rs = carpol (rs); 1942 jj = M_PI/2.0; 1943 ap = rs[1] + jj; // R.A. of ascending node 1944 jj = jj - rs[2]; // inclination 1945 1946 // in-orbit-plane position vector 1947 1948 u = pi2 * frac((200.913 + 61.2588532*d)/360.0); 1949 rs.assign (ax * cos(u), ax * sin(u), 0); 1950 1951 // velocity is perpendicular to radius vector for e=0 1952 u = 1.0 / abs(rs); 1953 vs = u * rs; 1954 mt1 = zrot (-M_PI/2.0); 1955 vs = mxvct (mt1, vs); 1956 u = 2.53538612E-3; // mean orbital speed 1957 vs *= u; 1958 1959 // convert to equatorial coordinates 1960 mt1 = xrot (-gam); 1961 rs = mxvct (mt1, rs); 1962 vs = mxvct (mt1, vs); 1963 nn = pi2 * frac((151.401 + 0.57806*d/365.25)/360.0); 1964 mt1 = zrot (-nn); 1965 rs = mxvct (mt1, rs); 1966 vs = mxvct (mt1, vs); 1967 mt1 = xrot (-jj); 1968 rs = mxvct (mt1, rs); 1969 vs = mxvct (mt1, vs); 1970 mt1 = zrot (-ap); 1971 rs = mxvct (mt1, rs); 1972 vs = mxvct (mt1, vs); 1973 1974 // convert to ecliptic coordinates of date 1975 mt1 = pmatequ (-0.500002096, t); 1976 rs = mxvct (mt1, rs); 1977 vs = mxvct (mt1, vs); 1978 rs = equecl (t, rs); 1979 vs = equecl (t, vs); 1980 1981 } 1982 1983 1984 /*----------------------- PluCharon ------------------------------------*/ 1985 void PluCharon (double t, Vec3& rs, Vec3& vs) 1986 { 1987 /* 1988 Ecliptic coordinates (in A.U.) rs and velocity vs (in A.U./day) 1989 of Charon with respect to Pluto for Equinox of Date. 1990 t is the time in Julian centuries since J2000. 1991 ====================================================================*/ 1992 1993 const double pi2 = M_PI * 2.0; 1994 const double ax = 0.00013102; 1995 const double jj = 94.3*M_PI/180.0; 1996 const double nn = 223.7*M_PI/180.0; 1997 1998 double d, u; 1999 Mat3 mt1; 2000 2001 // days since epoch 2002 d = t*36525 + 6544.5; 2003 2004 // in-orbit-plane position vector 2005 u = pi2 * frac((78.6 + 56.3625*d)/360.0); 2006 rs.assign (ax * cos(u), ax * sin(u), 0); 2007 2008 // velocity is perpendicular to radius vector for e=0 2009 d = 1.0 / abs(rs); 2010 vs = d * rs; 2011 mt1 = zrot (-M_PI/2.0); 2012 vs = mxvct (mt1, vs); 2013 d = 1.288837578E-4; // mean orbital speed 2014 vs *= d; 2015 2016 // convert to equatorial coordinates 2017 mt1 = xrot (-jj); 2018 rs = mxvct (mt1, rs); 2019 vs = mxvct (mt1, vs); 2020 mt1 = zrot (-nn); 2021 rs = mxvct (mt1, rs); 2022 vs = mxvct (mt1, vs); 2023 2024 // convert to ecliptic coordinates of date 2025 mt1 = pmatequ (-0.500002096, t); 2026 rs = mxvct (mt1, rs); 2027 vs = mxvct (mt1, vs); 2028 rs = equecl (t, rs); 2029 vs = equecl (t, vs); 2030 2031 } 2032