This commit is contained in:
Timur A. Fatkhullin 2025-08-21 19:02:11 +03:00
parent 33002f1711
commit 06c8345fc9
5 changed files with 22 additions and 2 deletions

View File

@ -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)

View File

@ -527,6 +527,10 @@ struct mcc_pzone_interface_t {
return std::forward<SelfT>(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 <std::derived_from<mcc_pzone_interface_t> SelfT, typename InputT>
RetT intersectPZone(this SelfT&& self, InputT coords, mcc_celestial_point_c auto* point)
requires(mcc_eqt_hrz_coord_c<InputT> || mcc_celestial_point_c<InputT>) &&

View File

@ -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<double>::quiet_NaN();
point->Y = std::numeric_limits<double>::quiet_NaN();
return ret;
}

View File

@ -212,6 +212,8 @@ public:
}
}
}
return ret;
};
return forEach(coords, apply_func, _inZoneFuncCPT, _inZoneFuncEHC);

View File

@ -1,4 +1,5 @@
#include <iostream>
#include <list>
#include "../mcc_ccte_erfa.h"
#include "../mcc_pzone.h"
@ -88,6 +89,16 @@ int main()
// std::vector<std::chrono::duration<double, std::ratio<60>>> vm;
std::vector<std::chrono::minutes> vm;
std::list<bool> 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";