Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

customorbit.cpp File Reference

#include <cassert>
#include <vector>
#include <fstream>
#include <iomanip>
#include <celmath/mathlib.h>
#include "astro.h"
#include "customorbit.h"
#include "vsop87.h"
#include "jpleph.h"

Include dependency graph for customorbit.cpp:

Go to the source code of this file.

Defines

#define LPEJ   0.23509484
#define TWOPI   6.28318530717958647692

Functions

void auxJSun (double t, double *x1, double *x2, double *x3, double *x4, double *x5, double *x6)
void ComputeGalileanElements (double t, double &l1, double &l2, double &l3, double &l4, double &p1, double &p2, double &p3, double &p4, double &w1, double &w2, double &w3, double &w4, double &gamma, double &phi, double &psi, double &G, double &Gp)
void computePlanetCoords (int p, double map, double da, double dhl, double dl, double dm, double dml, double dr, double ds, double &eclLong, double &eclLat, double &distance)
void computePlanetElements (double t, vector< int > pList)
void ComputeSaturnianElements (double t, double &t1, double &t2, double &t3, double &t4, double &t5, double &t6, double &t7, double &t8, double &t9, double &t10, double &t11, double &W0, double &W1, double &W2, double &W3, double &W4, double &W5, double &W6, double &W7, double &W8)
static double cosD (double theta)
static OrbitCreateJPLEphOrbit (JPLEphemItem body, double period, double boundingRadius)
static UranianSatelliteOrbitCreateUranianSatelliteOrbit (int n)
static void EclipticToEquatorial (double t, double fEclLat, double fEclLon, double &RA, double &dec)
static Point3d ellipsePosition (double a, double e, double M)
void EpochConvert (double jdFrom, double jdTo, double a0, double d0, double &a, double &d)
OrbitGetCustomOrbit (const string &name)
double meanAnomalySun (double t)
static void Nutation (double t, double &deps, double &dpsi)
static double Obliquity (double t)
static void OuterSaturnMoonParams (double a, double e, double i, double Om_, double M, double lam_, double &lam, double &gam, double &r, double &w)
static Point3d SaturnMoonPosition (double lam, double gam, double Om, double r)
static double sinD (double theta)
static double yearToJD (int year)

Variables

static const double BoundingRadiusSlack = 1.2
double gElements [8][23]
double gPlanetElements [8][9]
static JPLEphemerisjpleph = NULL
static bool jplephInitialized = false
static const double JupAscendingNode = degToRad(22.203)
static const double JupiterRadius = 71398.0
static const double SatAscendingNode = 168.8112
static const double SatTilt = 28.0817
static const double SaturnRadius = 60330.0
static double uran_a [5]
static double uran_L0 [5]
static double uran_L1 [5]
static double uran_L_k [5][3]
static double uran_L_phi [5][3]
static double uran_L_theta [5][3]
static double uran_n [5]
static double uran_z_k [5][5]
static double uran_z_phi [5][5]
static double uran_z_theta [5][5]
static double uran_zeta_k [5][2]
static double uran_zeta_phi [5][2]
static double uran_zeta_theta [5][2]


Define Documentation

#define LPEJ   0.23509484
 

Definition at line 24 of file customorbit.cpp.

Referenced by CallistoOrbit::computePosition(), GanymedeOrbit::computePosition(), EuropaOrbit::computePosition(), and IoOrbit::computePosition().

#define TWOPI   6.28318530717958647692
 

Definition at line 23 of file customorbit.cpp.

Referenced by auxJSun(), computePlanetCoords(), NeptuneOrbit::computePosition(), UranusOrbit::computePosition(), LunarOrbit::computePosition(), EarthOrbit::computePosition(), and EclipticToEquatorial().


Function Documentation

void auxJSun double  t,
double *  x1,
double *  x2,
double *  x3,
double *  x4,
double *  x5,
double *  x6
 

Definition at line 280 of file customorbit.cpp.

References pfmod(), and TWOPI.

Referenced by NeptuneOrbit::computePosition(), UranusOrbit::computePosition(), SaturnOrbit::computePosition(), and JupiterOrbit::computePosition().

00282 {
00283     *x1 = t/5+0.1;
00284     *x2 = pfmod(4.14473+5.29691e1*t, TWOPI);
00285     *x3 = pfmod(4.641118+2.132991e1*t, TWOPI);
00286     *x4 = pfmod(4.250177+7.478172*t, TWOPI);
00287     *x5 = 5 * *x3 - 2 * *x2;
00288     *x6 = 2 * *x2 - 6 * *x3 + 3 * *x4;
00289 }

void ComputeGalileanElements double  t,
double &  l1,
double &  l2,
double &  l3,
double &  l4,
double &  p1,
double &  p2,
double &  p3,
double &  p4,
double &  w1,
double &  w2,
double &  w3,
double &  w4,
double &  gamma,
double &  phi,
double &  psi,
double &  G,
double &  Gp
 

Definition at line 348 of file customorbit.cpp.

References sin().

Referenced by CallistoOrbit::computePosition(), GanymedeOrbit::computePosition(), EuropaOrbit::computePosition(), and IoOrbit::computePosition().

00354 {
00355     // Parameter t is Julian days, epoch 1950.0.
00356     l1 = 1.8513962 + 3.551552269981*t;
00357     l2 = 3.0670952 + 1.769322724929*t;
00358     l3 = 2.1041485 + 0.87820795239*t;
00359     l4 = 1.473836 + 0.37648621522*t;
00360 
00361     p1 = 1.69451 + 2.8167146e-3*t;
00362     p2 = 2.702927 + 8.248962e-4*t;
00363     p3 = 3.28443 + 1.24396e-4*t;
00364     p4 = 5.851859 + 3.21e-5*t;
00365 
00366     w1 = 5.451267 - 2.3176901e-3*t;
00367     w2 = 1.753028 - 5.695121e-4*t;
00368     w3 = 2.080331 - 1.25263e-4*t;
00369     w4 = 5.630757 - 3.07063e-5*t;
00370 
00371     gamma = 5.7653e-3*sin(2.85674 + 1.8347e-5*t) + 6.002e-4*sin(0.60189 - 2.82274e-4*t);
00372     phi = 3.485014 + 3.033241e-3*t;
00373     psi = 5.524285 - 3.63e-8*t;
00374     G = 0.527745 + 1.45023893e-3*t + gamma;
00375     Gp = 0.5581306 + 5.83982523e-4*t;
00376 }

void computePlanetCoords int  p,
double  map,
double  da,
double  dhl,
double  dl,
double  dm,
double  dml,
double  dr,
double  ds,
double &  eclLong,
double &  eclLat,
double &  distance
 

Definition at line 319 of file customorbit.cpp.

References astro::anomaly(), cos(), degToRad(), distance(), gPlanetElements, KM_PER_AU, pfmod(), PI, radToDeg(), sin(), and TWOPI.

Referenced by PlutoOrbit::computePosition(), NeptuneOrbit::computePosition(), UranusOrbit::computePosition(), SaturnOrbit::computePosition(), JupiterOrbit::computePosition(), MarsOrbit::computePosition(), VenusOrbit::computePosition(), and MercuryOrbit::computePosition().

00322 {
00323     double s, ma, nu, ea, lp, om, lo, slo, clo, inc, spsi, y;
00324 
00325     s = gPlanetElements[p][3] + ds;
00326     ma = map + dm;
00327     astro::anomaly(ma, s, nu, ea);
00328     distance = (gPlanetElements[p][6] + da)*(1 - s*s)/(1 + s*cos(nu));
00329     lp = radToDeg(nu) + gPlanetElements[p][2] + radToDeg(dml - dm);
00330     lp = degToRad(lp);
00331     om = degToRad(gPlanetElements[p][5]);
00332     lo = lp - om;
00333     slo = sin(lo);
00334     clo = cos(lo);
00335     inc = degToRad(gPlanetElements[p][4]);
00336     distance += dr;
00337     spsi = slo*sin(inc);
00338     y = slo*cos(inc);
00339     eclLat = asin(spsi) + dhl;
00340     spsi = sin(eclLat);
00341     eclLong = atan(y/clo) + om + degToRad(dl);
00342     if (clo < 0)
00343         eclLong += PI;
00344     eclLong = pfmod(eclLong, TWOPI);
00345     distance *= KM_PER_AU;
00346 }

void computePlanetElements double  t,
vector< int >  pList
 

Definition at line 291 of file customorbit.cpp.

References gElements, gPlanetElements, and pfmod().

Referenced by PlutoOrbit::computePosition(), NeptuneOrbit::computePosition(), UranusOrbit::computePosition(), SaturnOrbit::computePosition(), JupiterOrbit::computePosition(), MarsOrbit::computePosition(), VenusOrbit::computePosition(), and MercuryOrbit::computePosition().

00292 {
00293     // Parameter t represents the Julian centuries elapsed since 1900.
00294     // In other words, t = (jd - 2415020.0) / 36525.0
00295 
00296     double *ep, *pp;
00297     double aa;
00298     int planet;
00299 
00300     for(unsigned i = 0; i < pList.size(); i++)
00301     {
00302         planet = pList[i];
00303         ep = gElements[planet];
00304         pp = gPlanetElements[planet];
00305         aa = ep[1]*t;
00306         pp[0] = ep[0] + 360*(aa-(int)aa) + (ep[3]*t + ep[2])*t*t;
00307         *pp = pfmod(*pp, 360.0);
00308         pp[1] = (ep[1]*9.856263e-3) + (ep[2] + ep[3])/36525;
00309 
00310         for(unsigned j = 4; j < 20; j += 4)
00311             pp[j/4+1] = ((ep[j+3]*t + ep[j+2])*t + ep[j+1])*t + ep[j+0];
00312 
00313         pp[6] = ep[20];
00314         pp[7] = ep[21];
00315         pp[8] = ep[22];
00316     }
00317 }

void ComputeSaturnianElements double  t,
double &  t1,
double &  t2,
double &  t3,
double &  t4,
double &  t5,
double &  t6,
double &  t7,
double &  t8,
double &  t9,
double &  t10,
double &  t11,
double &  W0,
double &  W1,
double &  W2,
double &  W3,
double &  W4,
double &  W5,
double &  W6,
double &  W7,
double &  W8
 

Definition at line 1902 of file customorbit.cpp.

Referenced by IapetusOrbit::computePosition(), HyperionOrbit::computePosition(), TitanOrbit::computePosition(), RheaOrbit::computePosition(), DioneOrbit::computePosition(), TethysOrbit::computePosition(), EnceladusOrbit::computePosition(), and MimasOrbit::computePosition().

01910 {
01911     t1 = t - 2411093.0;
01912     t2 = t1 / 365.25;
01913     t3 = (t - 2433282.423) / 365.25 + 1950.0;
01914     t4 = t - 2411368.0;
01915     t5 = t4 / 365.25;
01916     t6 = t - 2415020.0;
01917     t7 = t6 / 36525;
01918     t8 = t6 / 365.25;
01919     t9 = (t - 2442000.5) / 365.25;
01920     t10 = t - 2409786.0;
01921     t11 = t10 / 36525;
01922 
01923     W0 = 5.095 * (t3 - 1866.39);
01924     W1 = 74.4 + 32.39 * t2;
01925     W2 = 134.3 + 92.62 * t2;
01926     W3 = 42.0 - 0.5118 * t5;
01927     W4 = 276.59 + 0.5118 * t5;
01928     W5 = 267.2635 + 1222.1136 * t7;
01929     W6 = 175.4762 + 1221.5515 * t7;
01930     W7 = 2.4891 + 0.002435 * t7;
01931     W8 = 113.35 - 0.2597 * t7;
01932 }

static double cosD double  theta  )  [static]
 

Definition at line 133 of file customorbit.cpp.

References cos(), and degToRad().

Referenced by IapetusOrbit::computePosition(), HyperionOrbit::computePosition(), TitanOrbit::computePosition(), RheaOrbit::computePosition(), DioneOrbit::computePosition(), EnceladusOrbit::computePosition(), MimasOrbit::computePosition(), and OuterSaturnMoonParams().

00134 {
00135     return cos(degToRad(theta));
00136 }

static Orbit* CreateJPLEphOrbit JPLEphemItem  body,
double  period,
double  boundingRadius
[static]
 

Definition at line 2746 of file customorbit.cpp.

References JPLEphemeris::getEndDate(), JPLEphemeris::getStartDate(), and jpleph.

Referenced by GetCustomOrbit().

02749 {
02750     Orbit* o = new JPLEphOrbit(*jpleph, body, period, boundingRadius);
02751     return new MixedOrbit(o,
02752                           jpleph->getStartDate(),
02753                           jpleph->getEndDate(),
02754                           astro::SolarMass);
02755 }

static UranianSatelliteOrbit* CreateUranianSatelliteOrbit int  n  )  [static]
 

Definition at line 2620 of file customorbit.cpp.

References uran_a, uran_L0, uran_L1, uran_L_k, uran_L_phi, uran_L_theta, uran_n, uran_z_k, uran_z_phi, uran_z_theta, uran_zeta_k, uran_zeta_phi, and uran_zeta_theta.

Referenced by GetCustomOrbit().

02621 {
02622     assert(n >= 1 && n <= 5);
02623     n--;
02624 
02625     return new UranianSatelliteOrbit(uran_a[n], uran_n[n],
02626                                      uran_L0[n], uran_L1[n],
02627                                      3, 5, 2,
02628                                      uran_L_k[n], uran_L_theta[n],
02629                                      uran_L_phi[n], uran_z_k[n],
02630                                      uran_z_theta[n], uran_z_phi[n],
02631                                      uran_zeta_k[n], uran_zeta_theta[n],
02632                                      uran_zeta_phi[n]);
02633 };

static void EclipticToEquatorial double  t,
double  fEclLat,
double  fEclLon,
double &  RA,
double &  dec
[static]
 

Definition at line 205 of file customorbit.cpp.

References cos(), Nutation(), Obliquity(), pfmod(), PI, sin(), and TWOPI.

Referenced by LunarOrbit::computePosition().

00207 {
00208     // Parameter t represents the Julian centuries elapsed since 1900.
00209     // In other words, t = (jd - 2415020.0) / 36525.0
00210 
00211     double seps, ceps;  // sin and cos of mean obliquity
00212     double sx, cx, sy, cy, ty;
00213     double eps;
00214     double deps, dpsi;
00215 
00216     t = (astro::J2000 - 2415020.0) / 36525.0;
00217     t = 0;
00218     eps = Obliquity(t);         // mean obliquity for date
00219     Nutation(t, deps, dpsi);
00220     eps += deps;
00221     seps = sin(eps);
00222     ceps = cos(eps);
00223 
00224     sy = sin(fEclLat);
00225     cy = cos(fEclLat);                          // always non-negative
00226     if (fabs(cy)<1e-20)
00227         cy = 1e-20;             // insure > 0
00228     ty = sy/cy;
00229     cx = cos(fEclLon);
00230     sx = sin(fEclLon);
00231     dec = asin((sy*ceps)+(cy*seps*sx));
00232     RA = atan(((sx*ceps)-(ty*seps))/cx);
00233     if (cx<0)
00234         RA += PI;               // account for atan quad ambiguity
00235     RA = pfmod(RA, TWOPI);
00236 }

static Point3d ellipsePosition double  a,
double  e,
double  M
[static]
 

Definition at line 1277 of file customorbit.cpp.

References cos(), sin(), sqrt(), and square().

Referenced by DeimosOrbit::computePosition(), and PhobosOrbit::computePosition().

01278 {
01279     // Solve Kepler's equation--for a low eccentricity orbit, just a few
01280     // iterations is enough.
01281     double E = M;
01282     for (int k = 0; k < 3; k++)
01283         E = M + e * sin(E);
01284 
01285     return Point3d(a * (cos(E) - e),
01286                    0.0,
01287                    a * sqrt(1 - square(e)) * -sin(E));
01288 }

void EpochConvert double  jdFrom,
double  jdTo,
double  a0,
double  d0,
double &  a,
double &  d
 

Definition at line 241 of file customorbit.cpp.

References B, cos(), degToRad(), and sin().

Referenced by LunarOrbit::computePosition().

00244 {
00245     double T = (jdFrom - astro::J2000) / 36525.0;
00246     double t = (jdTo - jdFrom) / 36525.0;
00247             
00248     double zeta = (2306.2181 + 1.39656 * T - 0.000139 * T * T) * t +
00249         (0.30188 - 0.000344 * T) * t * t + 0.017998 * t * t * t;
00250     double z = (2306.2181 + 1.39656 * T - 0.000139 * T * T) * t +
00251         (1.09468 + 0.000066 * T) * t * t + 0.018203 * t * t * t;
00252     double theta = (2004.3109 - 0.85330 * T - 0.000217 * T * T) * t -
00253         (0.42665 + 0.000217 * T) * t * t - 0.041833 * t * t * t;
00254     zeta  = degToRad(zeta / 3600.0);
00255     z     = degToRad(z / 3600.0);
00256     theta = degToRad(theta / 3600.0);
00257 
00258     double A = cos(d0) * sin(a0 + zeta);
00259     double B = cos(theta) * cos(d0) * cos(a0 + zeta) -
00260         sin(theta) * sin(d0);
00261     double C = sin(theta) * cos(d0) * cos(a0 + zeta) +
00262         cos(theta) * sin(d0);
00263 
00264     a = atan2(A, B) + z;
00265     d = asin(C);
00266 }

Orbit* GetCustomOrbit const string name  ) 
 

Definition at line 2764 of file customorbit.cpp.

References CreateJPLEphOrbit(), CreateUranianSatelliteOrbit(), CreateVSOP87Orbit(), JPLEphemeris::getDENumber(), JPLEphemeris::getEndDate(), JPLEphemeris::getStartDate(), jpleph, JPLEph_EarthMoonBary, JPLEph_Jupiter, JPLEph_Mars, JPLEph_Mercury, JPLEph_Moon, JPLEph_Neptune, JPLEph_Pluto, JPLEph_Saturn, JPLEph_Uranus, JPLEph_Venus, jplephInitialized, JPLEphemeris::load(), and yearToJD().

Referenced by createCustomOrbit(), and CreateOrbit().

02765 {
02766     // Attempt to load JPL ephemeris data if we haven't tried already
02767     if (!jplephInitialized)
02768     {
02769         jplephInitialized = true;
02770         ifstream in("data/jpleph.dat", ios::in | ios::binary);
02771         if (in.good())
02772             jpleph = JPLEphemeris::load(in);
02773         if (jpleph != NULL)
02774         {
02775             clog << "Loaded DE" << jpleph->getDENumber() <<
02776                 " ephemeris. Valid from JD" <<
02777                 setprecision(8) <<
02778                 jpleph->getStartDate() << " to JD" <<
02779                 jpleph->getEndDate() << '\n';
02780         }
02781     }
02782 
02783     if (name == "mercury")
02784         return new MixedOrbit(new MercuryOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02785     if (name == "venus")
02786         return new MixedOrbit(new VenusOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02787     if (name == "earth")
02788         return new MixedOrbit(new EarthOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02789     if (name == "moon")
02790         return new MixedOrbit(new LunarOrbit(), yearToJD(-2000), yearToJD(4000), astro::EarthMass + astro::LunarMass);
02791     if (name == "mars")
02792         return new MixedOrbit(new MarsOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02793     if (name == "jupiter")
02794         return new MixedOrbit(new JupiterOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02795     if (name == "saturn")
02796         return new MixedOrbit(new SaturnOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02797     if (name == "uranus")
02798         return new MixedOrbit(new UranusOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02799     if (name == "neptune")
02800         return new MixedOrbit(new NeptuneOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02801     if (name == "pluto")
02802         return new MixedOrbit(new PlutoOrbit(), yearToJD(-4000), yearToJD(4000), astro::SolarMass);
02803     if (name == "mercury-jpl")
02804         return CreateJPLEphOrbit(JPLEph_Mercury,  0.2408  * 365.25, 6.0e7);
02805     if (name == "venus-jpl")
02806         return CreateJPLEphOrbit(JPLEph_Venus,    0.6152  * 365.25, 1.0e8);
02807     if (name == "earth-jpl")
02808         return CreateJPLEphOrbit(JPLEph_EarthMoonBary,      365.25, 1.6e8);
02809     if (name == "mars-jpl")
02810         return CreateJPLEphOrbit(JPLEph_Mars,      1.8809 * 365.25, 2.4e8);
02811     if (name == "jupiter-jpl")
02812         return CreateJPLEphOrbit(JPLEph_Jupiter,  11.86   * 365.25, 8.0e8);
02813     if (name == "saturn-jpl")
02814         return CreateJPLEphOrbit(JPLEph_Saturn,   29.4577 * 365.25, 1.5e9);
02815     if (name == "uranus-jpl")
02816         return CreateJPLEphOrbit(JPLEph_Uranus,   84.0139 * 365.25, 3.0e9);
02817     if (name == "neptune-jpl")
02818         return CreateJPLEphOrbit(JPLEph_Neptune, 164.793  * 365.25, 4.7e9);
02819     if (name == "pluto-jpl")
02820         return CreateJPLEphOrbit(JPLEph_Pluto,   248.54   * 365.25, 6.0e9);
02821     if (name == "moon-jpl")
02822         return CreateJPLEphOrbit(JPLEph_Moon,     27.321661,        5.0e5);
02823     if (name == "phobos")
02824         return new PhobosOrbit();
02825     if (name == "deimos")
02826         return new DeimosOrbit();
02827     if (name == "io")
02828         return new IoOrbit();
02829     if (name == "europa")
02830         return new EuropaOrbit();
02831     if (name == "ganymede")
02832         return new GanymedeOrbit();
02833     if (name == "callisto")
02834         return new CallistoOrbit();
02835     if (name == "mimas")
02836         return new MimasOrbit();
02837     if (name == "enceladus")
02838         return new EnceladusOrbit();
02839     if (name == "tethys")
02840         return new TethysOrbit();
02841     if (name == "dione")
02842         return new DioneOrbit();
02843     if (name == "rhea")
02844         return new RheaOrbit();
02845     if (name == "titan")
02846         return new TitanOrbit();
02847     if (name == "hyperion")
02848         return new HyperionOrbit();
02849     if (name == "iapetus")
02850         return new IapetusOrbit();
02851     if (name == "phoebe")
02852         return new PhoebeOrbit();
02853     if (name == "miranda")
02854         return CreateUranianSatelliteOrbit(1);
02855     if (name == "ariel")
02856         return CreateUranianSatelliteOrbit(2);
02857     if (name == "umbriel")
02858         return CreateUranianSatelliteOrbit(3);
02859     if (name == "titania")
02860         return CreateUranianSatelliteOrbit(4);
02861     if (name == "oberon")
02862         return CreateUranianSatelliteOrbit(5);
02863     if (name == "triton")
02864         return new TritonOrbit();
02865     else
02866         return CreateVSOP87Orbit(name);
02867 }

double meanAnomalySun double  t  ) 
 

Definition at line 269 of file customorbit.cpp.

References degToRad().

Referenced by MarsOrbit::computePosition(), EarthOrbit::computePosition(), and VenusOrbit::computePosition().

00270 {
00271     double t2, a, b;
00272 
00273         t2 = t*t;
00274         a = 9.999736042e1*t;
00275         b = 360*(a - (int)a);
00276         
00277     return degToRad(3.5847583e2 - (1.5e-4 + 3.3e-6*t)*t2 + b);
00278 }

static void Nutation double  t,
double &  deps,
double &  dpsi
[static]
 

Definition at line 147 of file customorbit.cpp.

References cos(), degToRad(), and sin().

Referenced by EclipticToEquatorial().

00148 {
00149     // Parameter t represents the Julian centuries elapsed since 1900.
00150     // In other words, t = (jd - 2415020.0) / 36525.0
00151 
00152     double ls, ld;      // sun's mean longitude, moon's mean longitude
00153     double ms, md;      // sun's mean anomaly, moon's mean anomaly
00154     double nm;      // longitude of moon's ascending node
00155     double t2;
00156     double tls, tnm, tld;       // twice above
00157     double a, b;
00158 
00159     t2 = t*t;
00160 
00161     a = 100.0021358*t;
00162     b = 360.*(a-(int)a);
00163     ls = 279.697+.000303*t2+b;
00164 
00165     a = 1336.855231*t;
00166     b = 360.*(a-(int)a);
00167     ld = 270.434-.001133*t2+b;
00168 
00169     a = 99.99736056000026*t;
00170     b = 360.*(a-(int)a);
00171     ms = 358.476-.00015*t2+b;
00172 
00173     a = 13255523.59*t;
00174     b = 360.*(a-(int)a);
00175     md = 296.105+.009192*t2+b;
00176 
00177     a = 5.372616667*t;
00178     b = 360.*(a-(int)a);
00179     nm = 259.183+.002078*t2-b;
00180 
00181     //convert to radian forms for use with trig functions.
00182     tls = 2*degToRad(ls);
00183     nm = degToRad(nm);
00184     tnm = 2*degToRad(nm);
00185     ms = degToRad(ms);
00186     tld = 2*degToRad(ld);
00187     md = degToRad(md);
00188 
00189     // find delta psi and eps, in arcseconds.
00190     dpsi = (-17.2327-.01737*t)*sin(nm)+(-1.2729-.00013*t)*sin(tls)
00191         +.2088*sin(tnm)-.2037*sin(tld)+(.1261-.00031*t)*sin(ms)
00192         +.0675*sin(md)-(.0497-.00012*t)*sin(tls+ms)
00193         -.0342*sin(tld-nm)-.0261*sin(tld+md)+.0214*sin(tls-ms)
00194         -.0149*sin(tls-tld+md)+.0124*sin(tls-nm)+.0114*sin(tld-md);
00195     deps = (9.21+.00091*t)*cos(nm)+(.5522-.00029*t)*cos(tls)
00196         -.0904*cos(tnm)+.0884*cos(tld)+.0216*cos(tls+ms)
00197         +.0183*cos(tld-nm)+.0113*cos(tld+md)-.0093*cos(tls-ms)
00198         -.0066*cos(tls-nm);
00199 
00200     // convert to radians.
00201     dpsi = degToRad(dpsi/3600);
00202     deps = degToRad(deps/3600);
00203 }

static double Obliquity double  t  )  [static]
 

Definition at line 139 of file customorbit.cpp.

References degToRad().

Referenced by EclipticToEquatorial().

00140 {
00141     // Parameter t represents the Julian centuries elapsed since 1900.
00142     // In other words, t = (jd - 2415020.0) / 36525.0
00143 
00144     return degToRad(2.345229444E1 - ((((-1.81E-3*t)+5.9E-3)*t+4.6845E1)*t)/3600.0);
00145 }

static void OuterSaturnMoonParams double  a,
double  e,
double  i,
double  Om_,
double  M,
double  lam_,
double &  lam,
double &  gam,
double &  r,
double &  w
[static]
 

Definition at line 1957 of file customorbit.cpp.

References cosD(), radToDeg(), SatAscendingNode, SatTilt, sinD(), sqrt(), and square().

Referenced by PhoebeOrbit::computePosition(), IapetusOrbit::computePosition(), HyperionOrbit::computePosition(), TitanOrbit::computePosition(), and RheaOrbit::computePosition().

01961 {
01962     double s1 = sinD(SatTilt);
01963     double c1 = cosD(SatTilt);
01964     double e_2 = e * e;
01965     double e_3 = e_2 * e;
01966     double e_4 = e_3 * e;
01967     double e_5 = e_4 * e;
01968     double C = (2 * e - 0.25 * e_3 + 0.0520833333 * e_5) * sinD(M) +
01969         (1.25 * e_2 - 0.458333333 * e_4) * sinD(2 * M) +
01970         (1.083333333 * e_3 - 0.671875 * e_5) * sinD(3 * M) +
01971         1.072917 * e_4 * sinD(4 * M) + 1.142708 * e_5 * sinD(5 * M);
01972     double g = Om_ - SatAscendingNode;
01973     double a1 = sinD(i) * sinD(g);
01974     double a2 = c1 * sinD(i) * cosD(g) - s1 * cosD(i);
01975     double u = radToDeg(atan2(a1, a2));
01976     double h = c1 * sinD(i) - s1 * cosD(i) * cosD(g);
01977     double psi = radToDeg(atan2(s1 * sinD(g), h));
01978 
01979     C = radToDeg(C);
01980     lam = lam_ + C + u - g - psi;
01981     gam = radToDeg(asin(sqrt(square(a1) + square(a2))));
01982     r = a * (1 - e * e) / (1 + e * cosD(M + C));
01983     w = SatAscendingNode + u;
01984 }

static Point3d SaturnMoonPosition double  lam,
double  gam,
double  Om,
double  r
[static]
 

Definition at line 1935 of file customorbit.cpp.

References cos(), degToRad(), SatAscendingNode, SaturnRadius, and sin().

Referenced by PhoebeOrbit::computePosition(), IapetusOrbit::computePosition(), HyperionOrbit::computePosition(), TitanOrbit::computePosition(), RheaOrbit::computePosition(), DioneOrbit::computePosition(), TethysOrbit::computePosition(), EnceladusOrbit::computePosition(), and MimasOrbit::computePosition().

01936 {
01937     double u = lam - Om;
01938     double w = Om - SatAscendingNode;
01939 
01940     u = degToRad(u);
01941     w = degToRad(w);
01942     gam = -degToRad(gam);
01943     r = r * SaturnRadius;
01944 
01945     // Corrections for Celestia's coordinate system
01946     u = -u;
01947     w = -w;
01948 
01949     double x = r * (cos(u) * cos(w) - sin(u) * sin(w) * cos(gam));
01950     double y = r * sin(u) * sin(gam);
01951     double z = r * (sin(u) * cos(w) * cos(gam) + cos(u) * sin(w));
01952 
01953     return Point3d(x, y, z);
01954 }

static double sinD double  theta  )  [static]
 

Definition at line 128 of file customorbit.cpp.

References degToRad(), and sin().

Referenced by IapetusOrbit::computePosition(), HyperionOrbit::computePosition(), TitanOrbit::computePosition(), RheaOrbit::computePosition(), DioneOrbit::computePosition(), TethysOrbit::computePosition(), EnceladusOrbit::computePosition(), MimasOrbit::computePosition(), and OuterSaturnMoonParams().

00129 {
00130     return sin(degToRad(theta));
00131 }

static double yearToJD int  year  )  [static]
 

Definition at line 2758 of file customorbit.cpp.

Referenced by CreateVSOP87Orbit(), and GetCustomOrbit().

02759 {
02760     return (double) astro::Date(year, 1, 1);
02761 }


Variable Documentation

const double BoundingRadiusSlack = 1.2 [static]
 

Definition at line 36 of file customorbit.cpp.

Referenced by TritonOrbit::getBoundingRadius(), UranianSatelliteOrbit::getBoundingRadius(), PhoebeOrbit::getBoundingRadius(), IapetusOrbit::getBoundingRadius(), HyperionOrbit::getBoundingRadius(), TitanOrbit::getBoundingRadius(), RheaOrbit::getBoundingRadius(), DioneOrbit::getBoundingRadius(), TethysOrbit::getBoundingRadius(), EnceladusOrbit::getBoundingRadius(), MimasOrbit::getBoundingRadius(), CallistoOrbit::getBoundingRadius(), GanymedeOrbit::getBoundingRadius(), EuropaOrbit::getBoundingRadius(), IoOrbit::getBoundingRadius(), DeimosOrbit::getBoundingRadius(), PhobosOrbit::getBoundingRadius(), PlutoOrbit::getBoundingRadius(), NeptuneOrbit::getBoundingRadius(), UranusOrbit::getBoundingRadius(), SaturnOrbit::getBoundingRadius(), JupiterOrbit::getBoundingRadius(), MarsOrbit::getBoundingRadius(), LunarOrbit::getBoundingRadius(), EarthOrbit::getBoundingRadius(), VenusOrbit::getBoundingRadius(), and MercuryOrbit::getBoundingRadius().

double gElements[8][23]
 

Definition at line 43 of file customorbit.cpp.

Referenced by computePlanetElements().

double gPlanetElements[8][9]
 

Definition at line 42 of file customorbit.cpp.

Referenced by computePlanetCoords(), computePlanetElements(), PlutoOrbit::computePosition(), NeptuneOrbit::computePosition(), UranusOrbit::computePosition(), SaturnOrbit::computePosition(), JupiterOrbit::computePosition(), MarsOrbit::computePosition(), VenusOrbit::computePosition(), and MercuryOrbit::computePosition().

JPLEphemeris* jpleph = NULL [static]
 

Definition at line 39 of file customorbit.cpp.

Referenced by CreateJPLEphOrbit(), and GetCustomOrbit().

bool jplephInitialized = false [static]
 

Definition at line 38 of file customorbit.cpp.

Referenced by GetCustomOrbit().

const double JupAscendingNode = degToRad(22.203) [static]
 

Definition at line 1494 of file customorbit.cpp.

Referenced by CallistoOrbit::computePosition(), GanymedeOrbit::computePosition(), EuropaOrbit::computePosition(), and IoOrbit::computePosition().

const double JupiterRadius = 71398.0 [static]
 

Definition at line 28 of file customorbit.cpp.

Referenced by CallistoOrbit::computePosition(), GanymedeOrbit::computePosition(), EuropaOrbit::computePosition(), and IoOrbit::computePosition().

const double SatAscendingNode = 168.8112 [static]
 

Definition at line 1893 of file customorbit.cpp.

Referenced by OuterSaturnMoonParams(), and SaturnMoonPosition().

const double SatTilt = 28.0817 [static]
 

Definition at line 1894 of file customorbit.cpp.

Referenced by OuterSaturnMoonParams().

const double SaturnRadius = 60330.0 [static]
 

Definition at line 29 of file customorbit.cpp.

Referenced by PhoebeOrbit::computePosition(), and SaturnMoonPosition().

double uran_a[5] [static]
 

Initial value:

{ 129800, 191200, 266000, 435800, 583600 }

Definition at line 2550 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_L0[5] [static]
 

Initial value:

{ -0.23805158, 3.09804641, 2.28540169, 0.85635879, -0.91559180 }

Definition at line 2552 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_L1[5] [static]
 

Initial value:

{ 4.44519055, 2.49295252, 1.51614811, 0.72171851, 0.46669212 }

Definition at line 2554 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_L_k[5][3] [static]
 

Initial value:

 {
{  0.02547217, -0.00308831, -3.181e-4 },
{ -1.86050e-3, 2.1999e-4, 0 },
{ 6.6057e-4, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
}

Definition at line 2556 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_L_phi[5][3] [static]
 

Initial value:

 {
{ 1.32, 2.64, 3.97 },
{ 1.32, 2.64, 0 },
{ 1.32, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },   
}

Definition at line 2570 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_L_theta[5][3] [static]
 

Initial value:

 {
{ -2.18167e-4, -4.36336e-4, -6.54502e-4 },
{ -2.18167e-4, -4.36336e-4, 0 },
{ -2.18167e-4, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
}

Definition at line 2563 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_n[5] [static]
 

Initial value:

{ 4.44352267, 2.49254257, 1.51595490, 0.72166316, 0.46658054 }

Definition at line 2548 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_z_k[5][5] [static]
 

Initial value:

 {
{ 1.31238e-3, -1.2331e-4, -1.9410e-4, 0, 0 },
{ 1.18763e-3, 8.6159e-4, 0, 0, 0 },
{ -2.2795e-4, 3.90496e-3, 3.0917e-4, 2.2192e-4, 5.4923e-4 },
{ 9.3281e-4, 1.12089e-3, 7.9343e-4, 0, 0 },
{ -7.5868e-4, 1.39734e-3, -9.8726e-4, 0, 0 }
}

Definition at line 2577 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_z_phi[5][5] [static]
 

Initial value:

 {
{ 0.61, 0.15, 6.04, 0, 0 },
{ 2.41, 2.07, 0, 0, 0 },
{ 2.41, 2.07, 0.74, 0.43, 5.71 },
{ 0.74, 0.43, 1.82, 0, 0 },
{ 0.74, 0.43, 1.82, 0, 0 }
}

Definition at line 2591 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_z_theta[5][5] [static]
 

Initial value:

 {
{ 1.5273e-4, 0.08606, 0.709, 0, 0 },
{ 4.727824e-5, 2.179316e-5, 0, 0, 0 },
{ 4.727824e-5, 2.179132e-5, 1.580524e-5, 2.9363068e-6, -0.01157 },
{ 1.580524e-5, 2.9363068e-6, -6.9008e-3, 0, 0 },
{ 1.580524e-5, 2.9363068e-6, -6.9008e-3, 0, 0 }
}

Definition at line 2584 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_zeta_k[5][2] [static]
 

Initial value:

 {
{ 0.03787171, 0 },
{ 3.5825e-4, 2.9008e-4 },
{ 1.11336e-3, 3.5014e-4 },
{ 6.8572e-4, 3.7832e-4 },
{ -5.9633e-4, 4.5169e-4 }
}

Definition at line 2598 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_zeta_phi[5][2] [static]
 

Initial value:

 {
{ 5.70, 0 },
{ 0.40, 0.59 },
{ 0.59, 1.75 },
{ 1.75, 4.21 },
{ 1.75, 4.21 },
}

Definition at line 2612 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().

double uran_zeta_theta[5][2] [static]
 

Initial value:

 {
{ -1.54449e-4, 0 },
{ -4.782474e-5, -2.156628e-5 },
{ -2.156628e-5, -1.401373e-5 },
{ -1.401373e-5, -1.9713918e-6 },
{ -1.401373e-5, -1.9713918e-6 }
}

Definition at line 2605 of file customorbit.cpp.

Referenced by CreateUranianSatelliteOrbit().


Generated on Sat Jan 14 22:30:43 2006 for Celestia by  doxygen 1.4.1