diff --git a/libsgp4/DateTime.h b/libsgp4/DateTime.h index 557011f..6d0d1c2 100644 --- a/libsgp4/DateTime.h +++ b/libsgp4/DateTime.h @@ -618,6 +618,16 @@ public: return Util::WrapTwoPI(Util::DegreesToRadians(theta / 240.0)); } + /** + * Return the modified julian date since the j2000 epoch + * January 1, 2000, at 12:00 TT + * @returns the modified julian date + */ + double ToJ2000() const + { + return ToJulian() - 2415020.0; + } + /** * Convert to local mean sidereal time (GMST plus the observer's longitude) * @param[in] lon observers longitude diff --git a/libsgp4/Globals.h b/libsgp4/Globals.h index 0f7b2bc..d756832 100644 --- a/libsgp4/Globals.h +++ b/libsgp4/Globals.h @@ -70,14 +70,5 @@ const double kSECONDS_PER_DAY = 86400.0; const double kMINUTES_PER_DAY = 1440.0; const double kHOURS_PER_DAY = 24.0; -// Jan 1.0 1900 = Jan 1 1900 00h UTC -const double kEPOCH_JAN1_00H_1900 = 2415019.5; - -// Jan 1.5 1900 = Jan 1 1900 12h UTC -const double kEPOCH_JAN1_12H_1900 = 2415020.0; - -// Jan 1.5 2000 = Jan 1 2000 12h UTC -const double kEPOCH_JAN1_12H_2000 = 2451545.0; - #endif diff --git a/libsgp4/SGP4.cpp b/libsgp4/SGP4.cpp index e8f0b50..fe92c80 100644 --- a/libsgp4/SGP4.cpp +++ b/libsgp4/SGP4.cpp @@ -672,7 +672,7 @@ void SGP4::DeepSpaceInitialise( /* * initialize lunar / solar terms */ - const double jday = elements_.Epoch().ToJulian() - kEPOCH_JAN1_12H_2000; + const double jday = elements_.Epoch().ToJ2000(); const double xnodce = 4.5236020 - 9.2422029e-4 * jday; const double xnodce_temp = fmod(xnodce, kTWOPI); diff --git a/libsgp4/SolarPosition.cpp b/libsgp4/SolarPosition.cpp index 11ae82e..1ddad9b 100644 --- a/libsgp4/SolarPosition.cpp +++ b/libsgp4/SolarPosition.cpp @@ -24,7 +24,7 @@ Eci SolarPosition::FindPosition(const DateTime& dt) { - const double mjd = dt.ToJulian() - kEPOCH_JAN1_12H_1900; + const double mjd = dt.ToJ2000(); const double year = 1900 + mjd / 365.25; const double T = (mjd + Delta_ET(year) / kSECONDS_PER_DAY) / 36525.0; const double M = Util::DegreesToRadians(Util::Wrap360(358.47583