This commit is contained in:
Timur A. Fatkhullin
2025-08-31 01:54:15 +03:00
parent 4696daa2ee
commit c2627ecd89
11 changed files with 324 additions and 180 deletions

View File

@@ -136,6 +136,13 @@ concept mcc_time_point_c = traits::mcc_systime_c<T>;
// concept mcc_time_point_c = requires(T t) { []<typename CT, typename DT>(std::chrono::time_point<CT, DT>) {}(t); };
template <mcc_time_point_c T1, mcc_time_point_c T2>
static constexpr void mcc_tp2tp(const T1& from_tp1, T2& to_tp)
{
to_tp = std::chrono::time_point_cast<typename T2::duration>(from_tp1);
}
/* JULIAN DAY CLASS CONCEPT */
template <typename T>
@@ -327,18 +334,66 @@ concept mcc_ccte_c = std::derived_from<T, mcc_CCTE_interface_t<typename T::error
template <typename T>
concept mcc_PCM_result_c = requires(T t) {
requires mcc_angle_c<decltype(t.dx)>;
requires mcc_angle_c<decltype(t.dy)>;
requires mcc_angle_c<decltype(t.pcmX)>;
requires mcc_angle_c<decltype(t.pcmY)>;
};
template <mcc_error_c RetT, mcc_PCM_result_c ResT>
template <mcc_error_c RetT>
struct mcc_PCM_interface_t {
virtual ~mcc_PCM_interface_t() = default;
// ignore app_pt->pair_kind and time points!!!
template <std::derived_from<mcc_PCM_interface_t> SelfT>
RetT computePCM(this SelfT&& self, mcc_celestial_point_c auto pt, ResT* result)
RetT computePCM(this SelfT&& self,
mcc_celestial_point_c auto pt,
mcc_PCM_result_c auto* result,
mcc_celestial_point_c auto* app_pt)
{
return std::forward<SelfT>(self).computePCM(std::move(pt), result);
return std::forward<SelfT>(self).computePCM(std::move(pt), result, app_pt);
}
// for equatorial mounts the method must compute:
// app_pt->HA = pt.X + result->pcmX
// app_pt->DEC_APP = pt.Y + result->pcmY
// for alt-azimuthal:
// app_pt->AZ = pt.X + result->pcmX
// app_pt->ZD = pt.Y + result->pcmY
template <std::derived_from<mcc_PCM_interface_t> SelfT>
RetT computePCM(this SelfT&& self,
mcc_celestial_point_c auto pt,
mcc_PCM_result_c auto* result,
mcc_eqt_hrz_coord_c auto* app_pt)
{
return std::forward<SelfT>(self).computePCM(std::move(pt), result, app_pt);
}
template <std::derived_from<mcc_PCM_interface_t> SelfT>
RetT computeInversePCM(this SelfT&& self,
mcc_celestial_point_c auto app_pt,
mcc_PCM_result_c auto* inv_result,
mcc_celestial_point_c auto* hw_pt)
{
return std::forward<SelfT>(self).computePCM(std::move(app_pt), inv_result, hw_pt);
}
// NOTE: for computation of the corrections the method must use of app_pt.X and app_pt.Y
//
// for equatorial mounts the method must compute:
// hw_pt->X = app_pt.HA + inv_result.pcmX
// hw_pt->Y = app_pt.DEC_APP + inv_result.pcmY
// and inputs for the corrections computing are app_pt.HA and app_pt.DEC_APP
// for alt-azimuthal:
// hw_pt->X = app_pt.AZ + inv_result.pcmX
// hw_pt->Y = app_pt.ZD + inv_result.pcmY
// and inputs for the corrections computing are app_pt.ZA and app_pt.ZD
template <std::derived_from<mcc_PCM_interface_t> SelfT>
RetT computeInversePCM(this SelfT&& self,
mcc_eqt_hrz_coord_c auto app_pt,
mcc_PCM_result_c auto* inv_result,
mcc_celestial_point_c auto* hw_pt)
{
return std::forward<SelfT>(self).computePCM(std::move(app_pt), inv_result, hw_pt);
}
protected:
@@ -346,15 +401,14 @@ protected:
};
template <typename T>
concept mcc_PCM_c =
std::derived_from<T, mcc_PCM_interface_t<typename T::error_t, typename T::pcm_result_t>> && requires {
// the 'T' class must contain static constexpr member of 'MccMountType' type
requires std::same_as<decltype(T::mountType), const MccMountType>;
[]() {
static constexpr MccMountType val = T::mountType;
return val;
}(); // to ensure 'mountType' can be used in compile-time context
};
concept mcc_PCM_c = std::derived_from<T, mcc_PCM_interface_t<typename T::error_t>> && requires {
// the 'T' class must contain static constexpr member of 'MccMountType' type
requires std::same_as<decltype(T::mountType), const MccMountType>;
[]() {
static constexpr MccMountType val = T::mountType;
return val;
}(); // to ensure 'mountType' can be used in compile-time context
};
@@ -404,13 +458,13 @@ concept mcc_hardware_c = requires(T t, const T t_const) {
// a class that contains at least time point of measurement, coordinates for x,y axes, its moving rates and moving
// type
requires requires(typename T::hardware_state_t state) {
requires mcc_time_point_c<decltype(state.time_point)>; // time point
// a class that contains at least time point of measurement, coordinates for x,y axes,
// its moving rates and moving type
requires mcc_celestial_point_c<typename T::hardware_state_t> && requires(typename T::hardware_state_t state) {
// requires mcc_time_point_c<decltype(state.time_point)>; // time point
requires mcc_angle_c<decltype(state.X)>; // target or current co-longitude coordinate
requires mcc_angle_c<decltype(state.Y)>; // target or current co-latitude coordinate
// requires mcc_angle_c<decltype(state.X)>; // target or current co-longitude coordinate
// requires mcc_angle_c<decltype(state.Y)>; // target or current co-latitude coordinate
requires mcc_angle_c<decltype(state.speedX)>; // moving speed along co-longitude coordinate
requires mcc_angle_c<decltype(state.speedY)>; // moving speed along co-latitude coordinate