...
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "mcc_coord.h"
|
||||
#include "mount_astrom.h"
|
||||
|
||||
namespace mcc
|
||||
{
|
||||
@@ -10,7 +11,7 @@ namespace traits
|
||||
|
||||
template <typename T>
|
||||
concept mcc_prohibited_zone_c = requires(T t, const T const_t) {
|
||||
typename T::pzcoords_kind_t;
|
||||
typename T::pzcontext_t;
|
||||
|
||||
{ const_t.name() } -> std::same_as<std::string_view>;
|
||||
{ const_t.desc() } -> std::same_as<std::string_view>;
|
||||
@@ -18,22 +19,21 @@ concept mcc_prohibited_zone_c = requires(T t, const T const_t) {
|
||||
// check if given coordinates are within the zone
|
||||
{
|
||||
t.inZone(std::declval<const MccAngle&>(), std::declval<const MccAngle&>(),
|
||||
std::declval<typename T::pzcoords_kind_t>())
|
||||
std::declval<typename T::pzcontext_t>())
|
||||
} -> std::convertible_to<bool>;
|
||||
|
||||
// a time duration to reach the zone (0 - if already in the zone, chrono::duration<>::max() if never
|
||||
// reach the zone)
|
||||
{
|
||||
t.timeTo(std::declval<const MccAngle&>(), std::declval<const MccAngle&>(),
|
||||
std::declval<typename T::pzcoords_kind_t>(),
|
||||
std::declval<const std::chrono::system_clock::time_point&>())
|
||||
std::declval<typename T::pzcontext_t>(), std::declval<const std::chrono::system_clock::time_point&>())
|
||||
} -> mcc_time_duration_c;
|
||||
|
||||
// a time duration to exit the zone (0 - if already out of the zone, chrono::duration<>::max() if
|
||||
// never exit the zone)
|
||||
{
|
||||
t.timeFrom(std::declval<const MccAngle&>(), std::declval<const MccAngle&>(),
|
||||
std::declval<typename T::pzcoords_kind_t>(),
|
||||
std::declval<typename T::pzcontext_t>(),
|
||||
std::declval<const std::chrono::system_clock::time_point&>())
|
||||
} -> mcc_time_duration_c;
|
||||
};
|
||||
@@ -44,18 +44,21 @@ concept mcc_prohibited_zone_c = requires(T t, const T const_t) {
|
||||
class MccProhibitedZone
|
||||
{
|
||||
public:
|
||||
enum pzcoords_kind_t { COORDS_KIND_RADEC_IRCS, COORDS_KIND_RADEC_APP, COORDS_KIND_HADEC_APP, COORDS_KIND_AZALT };
|
||||
|
||||
struct pzcontext_t {
|
||||
typedef std::chrono::duration<double> real_secs_t; // seconds duration in double
|
||||
|
||||
pzcoords_kind_t coords_kind;
|
||||
|
||||
real_secs_t dut1; // UT1-UTC
|
||||
real_secs_t tt_tai; // TT-TAI
|
||||
real_secs_t tai_utc; // TAI-UTC (leap seconds)
|
||||
|
||||
MccAngle lat, lon; // site geographic coordinates
|
||||
};
|
||||
|
||||
virtual ~MccProhibitedZone() = default;
|
||||
|
||||
bool inZone(this auto&& self, const MccAngle& x, const MccAngle& y)
|
||||
{
|
||||
return std::forward<decltype(self)>(self).inZoneImpl(x, y);
|
||||
}
|
||||
|
||||
protected:
|
||||
bool inZoneImpl(const MccAngle&, const MccAngle&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class MccMinAltPZ : public MccProhibitedZone
|
||||
@@ -98,6 +101,47 @@ private:
|
||||
};
|
||||
|
||||
|
||||
enum class MccAltLimitKind { MIN_ALT_LIMIT, MAX_ALT_LIMIT };
|
||||
|
||||
template <MccAltLimitKind LIMIT = MccAltLimitKind::MIN_ALT_LIMIT>
|
||||
class MccAltLimitPZ
|
||||
{
|
||||
public:
|
||||
static constexpr MccAltLimitKind altLimitType = LIMIT;
|
||||
|
||||
MccAltLimitPZ(const MccAngle& alt_limit) : _altLimit(alt_limit)
|
||||
{
|
||||
_altLimit.normalize<MccAngle::NORM_KIND_90_90>();
|
||||
}
|
||||
|
||||
bool inZone(const MccAngle& x, const MccAngle& y, const MccProhibitedZone::pzcontext_t& context)
|
||||
{
|
||||
if (context.coords_kind == MccProhibitedZone::COORDS_KIND_AZALT) { // trivial case
|
||||
if constexpr (LIMIT == MccAltLimitKind::MIN_ALT_LIMIT) {
|
||||
return y <= _altLimit;
|
||||
} else if constexpr (LIMIT == MccAltLimitKind::MAX_ALT_LIMIT) {
|
||||
return y >= _altLimit;
|
||||
}
|
||||
} else if (context.coords_kind == MccProhibitedZone::COORDS_KIND_RADEC_APP) {
|
||||
auto dd =
|
||||
astrom::mcc_time_to_alt(_altLimit, x, y, context.lat, context.lon, std::chrono::system_clock::now(),
|
||||
context.dut1, context.tt_tai, context.tai_utc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
auto timeTo(const MccAngle& x,
|
||||
const MccAngle& y,
|
||||
const MccProhibitedZone::pzcontext_t& context,
|
||||
traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now())
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
MccAngle _altLimit;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* a general planar ellipse equation:
|
||||
* A*(x-xc)^2 + B*(x-xc)(y-yc) + C*(y-yc)^2 = 1
|
||||
@@ -168,10 +212,7 @@ public:
|
||||
}
|
||||
|
||||
// circle
|
||||
MccEllipsePZ(const MccAngle& xc, const MccAngle& yc, const MccAngle& a)
|
||||
: mcc::MccEllipsePZ(xc, yc, a, a)
|
||||
{
|
||||
}
|
||||
MccEllipsePZ(const MccAngle& xc, const MccAngle& yc, const MccAngle& a) : mcc::MccEllipsePZ(xc, yc, a, a) {}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user