diff --git a/mcc/CMakeLists.txt b/mcc/CMakeLists.txt index f0e6869..09a5cbb 100644 --- a/mcc/CMakeLists.txt +++ b/mcc/CMakeLists.txt @@ -66,7 +66,7 @@ message(STATUS ${ERFA_INCLUDE_DIR}) set(MCC_LIBRARY_SRC1 mcc_generics.h mcc_defaults.h mcc_traits.h mcc_utils.h mcc_ccte_iers.h mcc_ccte_iers_default.h mcc_ccte_erfa.h mcc_telemetry.h - mcc_pzone.h mcc_pzone_container.h) + mcc_angle.h mcc_pzone.h mcc_pzone_container.h) set(MCC_LIBRARY1 mcc1) add_library(${MCC_LIBRARY1} INTERFACE ${MCC_LIBRARY_SRC1}) target_compile_features(${MCC_LIBRARY1} INTERFACE cxx_std_23) diff --git a/mcc/mcc_generics.h b/mcc/mcc_generics.h index 400fcbd..ae97d1f 100644 --- a/mcc/mcc_generics.h +++ b/mcc/mcc_generics.h @@ -527,6 +527,10 @@ struct mcc_pzone_interface_t { return std::forward(self).timeFromPZone(std::move(coords), res_time); } + // + // NOTE: the method must return: + // point = mcc_celestial_point_c{.pair_kind = MccCoordPairKind::COORDS_KIND_GENERIC, .X = NaN, .Y = NaN} + // if there is no intersection with the zone for given coordinates! template SelfT, typename InputT> RetT intersectPZone(this SelfT&& self, InputT coords, mcc_celestial_point_c auto* point) requires(mcc_eqt_hrz_coord_c || mcc_celestial_point_c) && diff --git a/mcc/mcc_pzone.h b/mcc/mcc_pzone.h index 1c94b40..a23e9d4 100644 --- a/mcc/mcc_pzone.h +++ b/mcc/mcc_pzone.h @@ -288,7 +288,10 @@ public: auto cos_ha = (_sinAlim - sinDec * _sinLat) / cosDec / _cosLat; if (cos_ha > 1.0) { // no intersection - // compute culmination points? + point->pair_kind = MccCoordPairKind::COORDS_KIND_GENERIC; + point->X = std::numeric_limits::quiet_NaN(); + point->Y = std::numeric_limits::quiet_NaN(); + return ret; } diff --git a/mcc/mcc_pzone_container.h b/mcc/mcc_pzone_container.h index c023a60..c3215ab 100644 --- a/mcc/mcc_pzone_container.h +++ b/mcc/mcc_pzone_container.h @@ -212,6 +212,8 @@ public: } } } + + return ret; }; return forEach(coords, apply_func, _inZoneFuncCPT, _inZoneFuncEHC); diff --git a/mcc/tests/ccte_test.cpp b/mcc/tests/ccte_test.cpp index a8db752..083741a 100644 --- a/mcc/tests/ccte_test.cpp +++ b/mcc/tests/ccte_test.cpp @@ -1,4 +1,5 @@ #include +#include #include "../mcc_ccte_erfa.h" #include "../mcc_pzone.h" @@ -88,6 +89,16 @@ int main() // std::vector>> vm; std::vector vm; + std::list lb; + bool cf; + ret = pzcont.inPZone(eqhrz, &cf, &lb); + std::cout << "ret = " << ret.message() << "\n"; + std::cout << std::boolalpha; + std::cout << "IN ZONE 1: " << lb.front() << "\n"; + std::cout << "IN ZONE 2: " << lb.back() << "\n"; + std::cout << "COMMON IN ZONE 1,2: " << cf << "\n"; + + ret = pzcont.timeToPZone(eqhrz, &vm); std::cout << "ret = " << ret.message() << "\n"; std::cout << "TIME TO ZONE 1: " << vm[0] << "\n";