...
This commit is contained in:
@@ -299,12 +299,21 @@ public:
|
||||
|
||||
using real_days_t = std::chrono::duration<double, std::ratio<86400>>;
|
||||
|
||||
double ut1 = jd.MJD();
|
||||
double tt = jd.MJD();
|
||||
using jd_t = decltype(jd);
|
||||
|
||||
double mjd;
|
||||
if constexpr (std::floating_point<jd_t>) {
|
||||
mjd = jd - ERFA_DJM0;
|
||||
} else {
|
||||
mjd = jd.MJD();
|
||||
}
|
||||
|
||||
double ut1 = mjd;
|
||||
double tt = mjd;
|
||||
|
||||
std::lock_guard lock{*_stateMutex};
|
||||
|
||||
auto dut1 = _currentState._bulletinA.DUT1(jd.MJD());
|
||||
auto dut1 = _currentState._bulletinA.DUT1(mjd);
|
||||
|
||||
if (dut1.has_value()) {
|
||||
ut1 += std::chrono::duration_cast<real_days_t>(dut1.value()).count();
|
||||
@@ -312,7 +321,7 @@ public:
|
||||
return MccCCTE_ERFAErrorCode::ERROR_BULLETINA_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
auto tai_utc = _currentState._leapSeconds[jd.MJD()];
|
||||
auto tai_utc = _currentState._leapSeconds[mjd];
|
||||
if (tai_utc.has_value()) {
|
||||
tt += std::chrono::duration_cast<real_days_t>(tai_utc.value()).count();
|
||||
} else {
|
||||
@@ -471,7 +480,8 @@ public:
|
||||
double eo, lst, ha, dec, az, alt;
|
||||
|
||||
auto lst_eo = [&]() {
|
||||
ret = eqOrigins(from_pt.time_point, &eo);
|
||||
// ret = eqOrigins(from_pt.time_point, &eo);
|
||||
ret = equationOrigins(from_pt.time_point, &eo);
|
||||
if (!ret) {
|
||||
ret = timepointToAppSideral(from_pt.time_point, &lst, true);
|
||||
}
|
||||
@@ -566,7 +576,7 @@ public:
|
||||
return icrs2obs(from_pt, to_pt);
|
||||
}
|
||||
|
||||
// from apparent: copy corresponded coordinates and compute other ones
|
||||
// from apparent: copy corresponded coordinates and compute other ones (ignore to_pt->pair_kind)
|
||||
if (from_pt.pair_kind == MccCoordPairKind::COORDS_KIND_RADEC_APP) {
|
||||
to_pt->RA_APP = from_pt.X;
|
||||
to_pt->DEC_APP = from_pt.Y;
|
||||
@@ -647,6 +657,58 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
// equation of the origins
|
||||
|
||||
error_t equationOrigins(mcc_julday_c auto const& jd, mcc_angle_c auto* eo)
|
||||
{
|
||||
if (eo == nullptr) {
|
||||
return MccCCTE_ERFAErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
auto ret = MccCCTE_ERFAErrorCode::ERROR_OK;
|
||||
|
||||
double tt, mjd;
|
||||
|
||||
if constexpr (std::floating_point<decltype(jd)>) {
|
||||
mjd = jd - ERFA_DJM0;
|
||||
} else {
|
||||
mjd = jd.MJD();
|
||||
}
|
||||
|
||||
std::lock_guard lock{*_stateMutex};
|
||||
|
||||
using real_days_t = std::chrono::duration<double, std::ratio<86400>>;
|
||||
|
||||
auto tai_utc = _currentState._leapSeconds[mjd];
|
||||
if (tai_utc.has_value()) {
|
||||
tt = jd.MJD() + std::chrono::duration_cast<real_days_t>(tai_utc.value()).count();
|
||||
|
||||
auto tt_tai = _currentState._bulletinA.TT_TAI();
|
||||
tt += +std::chrono::duration_cast<real_days_t>(tt_tai).count();
|
||||
|
||||
*eo = eraEo06a(ERFA_DJM0, tt);
|
||||
} else {
|
||||
ret = MccCCTE_ERFAErrorCode::ERROR_LEAPSECONDS_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
error_t equationOrigins(mcc_time_point_c auto const& tp, mcc_angle_c auto* eo)
|
||||
{
|
||||
if (eo == nullptr) {
|
||||
return MccCCTE_ERFAErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
MccJulianDay jd;
|
||||
auto ret = timepointToJulday(tp, &jd);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return equationOrigins(std::move(jd), eo);
|
||||
}
|
||||
|
||||
|
||||
// refraction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user