diff --git a/cxx/mcc_mount_concepts.h b/cxx/mcc_mount_concepts.h index 71d1f6b..a4764c6 100644 --- a/cxx/mcc_mount_concepts.h +++ b/cxx/mcc_mount_concepts.h @@ -576,10 +576,10 @@ concept mcc_prohibited_zone_c = { t.timeFrom(std::declval()) } -> std::same_as; }; -// // an input range of prohibited zones -// template -// concept mcc_irange_of_pzones_c = mcc_mount_telemetry_data_c && std::ranges::input_range && -// mcc_prohibited_zone_c, TelemetryDataT>; +// an input range of prohibited zones +template +concept mcc_irange_of_pzones_c = mcc_mount_telemetry_data_c && std::ranges::input_range && + mcc_prohibited_zone_c, TelemetryDataT>; // // a concept for a callable with the first argument of type satisfied to 'mcc_prohibited_zone_c' diff --git a/cxx/mcc_mount_pz.h b/cxx/mcc_mount_pz.h index ffe0191..fc50e6f 100644 --- a/cxx/mcc_mount_pz.h +++ b/cxx/mcc_mount_pz.h @@ -200,6 +200,39 @@ public: } } + // compute intersection point for the case of sideral-like moving + bool intersectPoint(traits::mcc_celestial_point_c auto const& target, traits::mcc_celestial_point_c auto& int_point) + { + coord_t ha, dec, az; + + _coord2coord(target.coordPairKind, target.x, target.y, target.time_point, + MccCoordPairKind::COORDS_KIND_HADEC_APP, ha, dec); + + // compute HA for intersection point + double cos_ha = + (std::sin(_altLimit) - std::sin(dec) * std::sin(_latitude)) / std::cos(dec) / std::cos(_latitude); + + if (cos_ha > 1.0) { // no intersection + // compute culmination points? + return false; + } + + double cosA = -sin(dec) * std::cos(_latitude) + std::cos(dec) * std::sin(_latitude) * cos_ha; + cosA /= std::cos(_altLimit); + + if constexpr (KIND == + MccAltLimitKind::MIN_ALT_LIMIT) { // the closest time point is one after upper culmination + az = std::acos(cosA); + } else if constexpr (KIND == MccAltLimitKind::MAX_ALT_LIMIT) { // the closest time point is one before upper + // culmination + az = -std::acos(cosA); + } + + _coord2coord(MccCoordPairKind::COORDS_KIND_AZALT, az, _altLimit, target.time_point, int_point.coordPairKind, + int_point.x, int_point.y); + + return true; + } private: coord_t _altLimit, _latitude, _abs_lat, _lat_lim; @@ -274,13 +307,14 @@ private: } double ha; + // WARNING: what about south hemisphere?!!! if (before_upper_culm) { ha = -std::acos(cos_ha); // HA before upper culmination } else { ha = std::acos(cos_ha); // HA after upper culmination!! } - MccAngle time_ang = ha - ha_app; // in sideral time scale + coord_t time_ang = ha - ha_app; // in sideral time scale if (time_ang < 0.0) { // next day time_ang += pi2; diff --git a/cxx/mcc_mount_telemetry.h b/cxx/mcc_mount_telemetry.h index b6a2a7b..0a9574b 100644 --- a/cxx/mcc_mount_telemetry.h +++ b/cxx/mcc_mount_telemetry.h @@ -296,7 +296,7 @@ public: ast_err = this->_astromEngine.hadec2pa(current_data.mntHA, current_data.mntDEC, current_data.mntPA); if (!ast_err) { // target coordinates (assuming its ICRS RA-DEC are already given or computed) - typename mount_telemetry_data_t::eo_t eo; + typename astrom_engine_t::eo_t eo; ast_err = this->_astromEngine.icrs2obs(current_data.tagRA_ICRS, current_data.tagDEC_ICRS, current_data.jd, current_data.tagRA, current_data.tagDEC, current_data.tagHA, current_data.tagAZ, current_data.tagALT, eo); diff --git a/cxx/mcc_mount_telemetry_astrom.h b/cxx/mcc_mount_telemetry_astrom.h index dd4567a..2e6a76b 100644 --- a/cxx/mcc_mount_telemetry_astrom.h +++ b/cxx/mcc_mount_telemetry_astrom.h @@ -117,13 +117,11 @@ public: MccMountTelemetryAstromTransform& operator=(MccMountTelemetryAstromTransform&& other) { - if (this == &other) { - return; + if (this != &other) { + _pec = other._pec; + _astromEngine = other._astromEngine; } - _pec = other._pec; - _astromEngine = other._astromEngine; - return *this; } @@ -134,13 +132,11 @@ public: MccMountTelemetryAstromTransform& operator=(const MccMountTelemetryAstromTransform& other) { - if (this == &other) { - return; + if (this != &other) { + _pec = other._pec; + _astromEngine = other._astromEngine; } - _pec = other._pec; - _astromEngine = other._astromEngine; - return *this; } diff --git a/cxx/tests/astrom_test.cpp b/cxx/tests/astrom_test.cpp index e430c5c..d40394e 100644 --- a/cxx/tests/astrom_test.cpp +++ b/cxx/tests/astrom_test.cpp @@ -163,7 +163,7 @@ int main(int argc, char* argv[]) // std::cout << "\n\n\n\n"; - using engine_t = mcc::astrom::erfa::MccMountAstromEngineERFA<>; + using engine_t = mcc::astrom::erfa::MccMountAstromEngineERFA; engine_t::engine_state_t state; state.lon = 41.440732_degs; state.lat = 43.646711_degs;