This commit is contained in:
Timur A. Fatkhullin
2025-08-21 03:47:53 +03:00
parent 99a28d87ec
commit 33002f1711
8 changed files with 469 additions and 19 deletions

View File

@@ -84,11 +84,6 @@ class MccAltLimitPZ : public mcc_pzone_interface_t<std::error_code>
protected:
static constexpr auto pi2 = std::numbers::pi * 2.0;
template <traits::mcc_time_duration_c T>
static constexpr T infiniteDuration =
std::integral<typename T::rep> ? T{std::numeric_limits<typename T::rep>::max()}
: T{std::numeric_limits<typename T::rep>::infinity()};
public:
typedef std::error_code error_t;
@@ -115,6 +110,10 @@ public:
};
}
MccAltLimitPZ(MccAltLimitPZ&&) = default;
MccAltLimitPZ(const MccAltLimitPZ&) = default;
consteval std::string_view name() const
{
return KIND == MccAltLimitKind::MIN_ALT_LIMIT ? "MINALT-ZONE"
@@ -189,7 +188,7 @@ public:
}
if (!doesObjectReachZone(dec)) {
*res_time = infiniteDuration<res_t>;
*res_time = mcc_infinite_duration_v<res_t>;
return ret;
}
@@ -241,7 +240,7 @@ public:
}
if (!doesObjectExitFromZone(dec)) {
*res_time = infiniteDuration<res_t>;
*res_time = mcc_infinite_duration_v<res_t>;
return ret;
}
@@ -343,9 +342,13 @@ protected:
return false;
}
} else if constexpr (KIND == MccAltLimitKind::MAX_ALT_LIMIT) {
if ((dd < (_absLat - _altLimit)) || (dd > (_absLat + _altLimit))) { // never rise above altitude limit
auto z = std::numbers::pi / 2.0 - _altLimit;
if ((dd < (_absLat - z)) || (dd > (_absLat + z))) { // never rise above altitude limit
return false;
}
// if ((dd < (_absLat - _altLimit)) || (dd > (_absLat + _altLimit))) { // never rise above altitude limit
// return false;
// }
} else {
static_assert(false, "UNKNOWN ALTITUDE LIMIT TYPE!");
}
@@ -388,7 +391,8 @@ protected:
double cos_ha = (_sinAlim - std::sin(dec_app) * _sinLat) / std::cos(dec_app) / _cosLat;
if (cos_ha > 1.0) { // should not be!
*result = infiniteDuration<res_t>;
*result = mcc_infinite_duration_v<res_t>;
return;
}
double ha;