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

LunarOrbit Class Reference

Inheritance diagram for LunarOrbit:

Inheritance graph
Collaboration diagram for LunarOrbit:

Collaboration graph
List of all members.

Private Member Functions

Point3d computePosition (double jd) const
double getBoundingRadius () const
double getPeriod () const

Member Function Documentation

Point3d LunarOrbit::computePosition double  jd  )  const [inline, private, virtual]
 

Implements CachingOrbit.

Definition at line 580 of file customorbit.cpp.

References cos(), degToRad(), distance(), EclipticToEquatorial(), EpochConvert(), pfmod(), PI, sin(), and TWOPI.

00581     {
00582         double jd19, t, t2;
00583         double ld, ms, md, de, f, n, hp;
00584         double a, sa, sn, b, sb, c, sc, e, e2, l, g, w1, w2;
00585         double m1, m2, m3, m4, m5, m6;
00586         double eclLon, eclLat, horzPar, distance;
00587         double RA, dec;
00588 
00589         // Computation requires an abbreviated Julian day:
00590         // epoch January 0.5, 1900.
00591         jd19 = jd - 2415020.0;
00592         t = jd19/36525;
00593         t2 = t*t;
00594 
00595         m1 = jd19/27.32158213;
00596         m1 = 360.0*(m1-(int)m1);
00597         m2 = jd19/365.2596407;
00598         m2 = 360.0*(m2-(int)m2);
00599         m3 = jd19/27.55455094;
00600         m3 = 360.0*(m3-(int)m3);
00601         m4 = jd19/29.53058868;
00602         m4 = 360.0*(m4-(int)m4);
00603         m5 = jd19/27.21222039;
00604         m5 = 360.0*(m5-(int)m5);
00605         m6 = jd19/6798.363307;
00606         m6 = 360.0*(m6-(int)m6);
00607 
00608         ld = 270.434164+m1-(.001133-.0000019*t)*t2;
00609         ms = 358.475833+m2-(.00015+.0000033*t)*t2;
00610         md = 296.104608+m3+(.009192+.0000144*t)*t2;
00611         de = 350.737486+m4-(.001436-.0000019*t)*t2;
00612         f = 11.250889+m5-(.003211+.0000003*t)*t2;
00613         n = 259.183275-m6+(.002078+.000022*t)*t2;
00614 
00615         a = degToRad(51.2+20.2*t);
00616         sa = sin(a);
00617         sn = sin(degToRad(n));
00618         b = 346.56+(132.87-.0091731*t)*t;
00619         sb = .003964*sin(degToRad(b));
00620         c = degToRad(n+275.05-2.3*t);
00621         sc = sin(c);
00622         ld = ld+.000233*sa+sb+.001964*sn;
00623         ms = ms-.001778*sa;
00624         md = md+.000817*sa+sb+.002541*sn;
00625         f = f+sb-.024691*sn-.004328*sc;
00626         de = de+.002011*sa+sb+.001964*sn;
00627         e = 1-(.002495+7.52e-06*t)*t;
00628         e2 = e*e;
00629 
00630         ld = degToRad(ld);
00631         ms = degToRad(ms);
00632         n = degToRad(n);
00633         de = degToRad(de);
00634         f = degToRad(f);
00635         md = degToRad(md);
00636 
00637         l = 6.28875*sin(md)+1.27402*sin(2*de-md)+.658309*sin(2*de)+
00638             .213616*sin(2*md)-e*.185596*sin(ms)-.114336*sin(2*f)+
00639             .058793*sin(2*(de-md))+.057212*e*sin(2*de-ms-md)+
00640             .05332*sin(2*de+md)+.045874*e*sin(2*de-ms)+.041024*e*sin(md-ms);
00641         l = l-.034718*sin(de)-e*.030465*sin(ms+md)+.015326*sin(2*(de-f))-
00642             .012528*sin(2*f+md)-.01098*sin(2*f-md)+.010674*sin(4*de-md)+
00643             .010034*sin(3*md)+.008548*sin(4*de-2*md)-e*.00791*sin(ms-md+2*de)-
00644             e*.006783*sin(2*de+ms);
00645         l = l+.005162*sin(md-de)+e*.005*sin(ms+de)+.003862*sin(4*de)+
00646             e*.004049*sin(md-ms+2*de)+.003996*sin(2*(md+de))+
00647             .003665*sin(2*de-3*md)+e*.002695*sin(2*md-ms)+
00648             .002602*sin(md-2*(f+de))+e*.002396*sin(2*(de-md)-ms)-
00649             .002349*sin(md+de);
00650         l = l+e2*.002249*sin(2*(de-ms))-e*.002125*sin(2*md+ms)-
00651             e2*.002079*sin(2*ms)+e2*.002059*sin(2*(de-ms)-md)-
00652             .001773*sin(md+2*(de-f))-.001595*sin(2*(f+de))+
00653             e*.00122*sin(4*de-ms-md)-.00111*sin(2*(md+f))+.000892*sin(md-3*de);
00654         l = l-e*.000811*sin(ms+md+2*de)+e*.000761*sin(4*de-ms-2*md)+
00655             e2*.000704*sin(md-2*(ms+de))+e*.000693*sin(ms-2*(md-de))+
00656             e*.000598*sin(2*(de-f)-ms)+.00055*sin(md+4*de)+.000538*sin(4*md)+
00657             e*.000521*sin(4*de-ms)+.000486*sin(2*md-de);
00658         l = l+e2*.000717*sin(md-2*ms);
00659         eclLon = ld+degToRad(l);
00660         eclLon = pfmod(eclLon, TWOPI);
00661 
00662         g = 5.12819*sin(f)+.280606*sin(md+f)+.277693*sin(md-f)+
00663             .173238*sin(2*de-f)+.055413*sin(2*de+f-md)+.046272*sin(2*de-f-md)+
00664             .032573*sin(2*de+f)+.017198*sin(2*md+f)+.009267*sin(2*de+md-f)+
00665             .008823*sin(2*md-f)+e*.008247*sin(2*de-ms-f);
00666         g = g+.004323*sin(2*(de-md)-f)+.0042*sin(2*de+f+md)+
00667             e*.003372*sin(f-ms-2*de)+e*.002472*sin(2*de+f-ms-md)+
00668             e*.002222*sin(2*de+f-ms)+e*.002072*sin(2*de-f-ms-md)+
00669             e*.001877*sin(f-ms+md)+.001828*sin(4*de-f-md)-e*.001803*sin(f+ms)-
00670             .00175*sin(3*f);
00671         g = g+e*.00157*sin(md-ms-f)-.001487*sin(f+de)-e*.001481*sin(f+ms+md)+
00672             e*.001417*sin(f-ms-md)+e*.00135*sin(f-ms)+.00133*sin(f-de)+
00673             .001106*sin(f+3*md)+.00102*sin(4*de-f)+.000833*sin(f+4*de-md)+
00674             .000781*sin(md-3*f)+.00067*sin(f+4*de-2*md);
00675         g = g+.000606*sin(2*de-3*f)+.000597*sin(2*(de+md)-f)+
00676             e*.000492*sin(2*de+md-ms-f)+.00045*sin(2*(md-de)-f)+
00677             .000439*sin(3*md-f)+.000423*sin(f+2*(de+md))+
00678             .000422*sin(2*de-f-3*md)-e*.000367*sin(ms+f+2*de-md)-
00679             e*.000353*sin(ms+f+2*de)+.000331*sin(f+4*de);
00680         g = g+e*.000317*sin(2*de+f-ms+md)+e2*.000306*sin(2*(de-ms)-f)-
00681             .000283*sin(md+3*f);
00682         w1 = .0004664*cos(n);
00683         w2 = .0000754*cos(c);
00684         eclLat = degToRad(g)*(1-w1-w2);
00685 
00686         hp = .950724+.051818*cos(md)+.009531*cos(2*de-md)+.007843*cos(2*de)+
00687          .002824*cos(2*md)+.000857*cos(2*de+md)+e*.000533*cos(2*de-ms)+
00688          e*.000401*cos(2*de-md-ms)+e*.00032*cos(md-ms)-.000271*cos(de)-
00689          e*.000264*cos(ms+md)-.000198*cos(2*f-md);
00690         hp = hp+.000173*cos(3*md)+.000167*cos(4*de-md)-e*.000111*cos(ms)+
00691          .000103*cos(4*de-2*md)-.000084*cos(2*md-2*de)-
00692          e*.000083*cos(2*de+ms)+.000079*cos(2*de+2*md)+.000072*cos(4*de)+
00693          e*.000064*cos(2*de-ms+md)-e*.000063*cos(2*de+ms-md)+
00694          e*.000041*cos(ms+de);
00695         hp = hp+e*.000035*cos(2*md-ms)-.000033*cos(3*md-2*de)-
00696          .00003*cos(md+de)-.000029*cos(2*(f-de))-e*.000029*cos(2*md+ms)+
00697          e2*.000026*cos(2*(de-ms))-.000023*cos(2*(f-de)+md)+
00698          e*.000019*cos(4*de-ms-md);
00699         horzPar = degToRad(hp);
00700 
00701         // At this point we have values of ecliptic longitude, latitude and
00702         // horizontal parallax (eclLong, eclLat, horzPar) in radians.
00703 
00704         // Now compute distance using horizontal parallax.
00705         distance = 6378.14 / sin(horzPar);
00706 
00707         // Finally convert eclLat, eclLon to RA, Dec.
00708         EclipticToEquatorial(t, eclLat, eclLon, RA, dec);
00709 
00710         // RA and Dec are referred to the equinox of date; we want to use
00711         // the J2000 equinox instead.  A better idea would be to directly 
00712         // compute the position of the Moon in this coordinate system, but
00713         // this was easier.
00714         EpochConvert(jd, astro::J2000, RA, dec, RA, dec);
00715 
00716         // Corrections for internal coordinate system
00717         dec -= (PI/2);
00718         RA += PI;
00719 
00720         return Point3d(cos(RA) * sin(dec) * distance,
00721                        cos(dec) * distance,
00722                        -sin(RA) * sin(dec) * distance);
00723     };

double LunarOrbit::getBoundingRadius  )  const [inline, private, virtual]
 

Implements CachingOrbit.

Definition at line 730 of file customorbit.cpp.

References BoundingRadiusSlack.

00731     {
00732         return 405504 * BoundingRadiusSlack;
00733     };

double LunarOrbit::getPeriod  )  const [inline, private, virtual]
 

Implements CachingOrbit.

Definition at line 725 of file customorbit.cpp.

00726     {
00727         return 27.321661;
00728     };


The documentation for this class was generated from the following file:
Generated on Sat Jan 14 22:33:27 2006 for Celestia by  doxygen 1.4.1