From e1421a1c2ea43fb304e8249b3159b06c112d56c1 Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Tue, 29 Apr 2025 18:31:41 +0300 Subject: [PATCH] ... --- cxx/mount_astrom.h | 10 +++++----- cxx/mount_pz.h | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cxx/mount_astrom.h b/cxx/mount_astrom.h index 8a63c77..25cfb97 100644 --- a/cxx/mount_astrom.h +++ b/cxx/mount_astrom.h @@ -417,15 +417,15 @@ std::pair, std::chrono::duration> mcc_time auto C1C3 = C1_2 + C3_2; auto D = C2_2 * C3_2 - C1C3 * (C2_2 - C1_2); - if (D < 0.0) { + if (D < 0.0) { // object never reach given azimuth return {inf_dur, inf_dur}; } - auto cos_t1 = -(C2C3 + sqrt(D)) / C1C3; - auto cos_t2 = -(C2C3 - sqrt(D)) / C1C3; + auto cos_ha1 = -(C2C3 + sqrt(D)) / C1C3; + auto cos_ha2 = -(C2C3 - sqrt(D)) / C1C3; - auto sin_z1 = (C2 + C3 * cos_t1) / cos_az; - auto sin_z2 = (C2 + C3 * cos_t2) / cos_az; + auto sin_z1 = (C2 + C3 * cos_ha1) / cos_az; + auto sin_z2 = (C2 + C3 * cos_ha2) / cos_az; auto ut1 = now + dut1; auto tt = now + tai_utc + tt_tai; diff --git a/cxx/mount_pz.h b/cxx/mount_pz.h index 0513067..9dd7bdb 100644 --- a/cxx/mount_pz.h +++ b/cxx/mount_pz.h @@ -235,6 +235,14 @@ public: bool inZone(const MccAngle& x, const MccAngle& y, const MccProhibitedZone::pzcontext_t& context) { if (context.coords_kind == MccProhibitedZone::COORDS_KIND_AZALT) { // trivial case + auto xx = x; + xx.normalize(); // to [-180, 180] + + if (std::fabs(xx) <= _deltaAZ) { // check at the South + return true; + } else if (std::fabs(xx - std::numbers::pi) <= _deltaAZ) { // check at the North + return true; + } } return false;