...
This commit is contained in:
@@ -9,27 +9,28 @@
|
||||
|
||||
#include <mutex>
|
||||
#include "fitpack/fitpack.h"
|
||||
#include "mcc_mount_concepts.h"
|
||||
#include "mcc_mount_coord.h"
|
||||
|
||||
namespace mcc
|
||||
{
|
||||
|
||||
|
||||
namespace traits
|
||||
{
|
||||
// namespace traits
|
||||
// {
|
||||
|
||||
template <typename T, typename XT, typename YT>
|
||||
concept mcc_mount_pec_c = requires(T t, const T t_const, XT x, YT y) {
|
||||
typename T::pec_data_t;
|
||||
typename T::pec_result_t;
|
||||
// template <typename T, typename XT, typename YT>
|
||||
// concept mcc_mount_pec_c = requires(T t, const T t_const, XT x, YT y) {
|
||||
// typename T::pec_data_t;
|
||||
// typename T::pec_result_t;
|
||||
|
||||
{ t.setData(std::declval<typename T::pec_data_t>()) };
|
||||
{ t_const.getData() } -> std::same_as<typename T::pec_data_t>;
|
||||
// { t.setData(std::declval<typename T::pec_data_t>()) };
|
||||
// { t_const.getData() } -> std::same_as<typename T::pec_data_t>;
|
||||
|
||||
{ t.compute(std::declval<const XT&>(), std::declval<const YT&>()) } -> std::same_as<typename T::pec_result_t>;
|
||||
};
|
||||
// { t.compute(std::declval<const XT&>(), std::declval<const YT&>()) } -> std::same_as<typename T::pec_result_t>;
|
||||
// };
|
||||
|
||||
} // namespace traits
|
||||
// } // namespace traits
|
||||
|
||||
// type of PEC corrections (algorithm used):
|
||||
// PEC_TYPE_GEOMETRY - "classic" geometry-based correction coefficients
|
||||
@@ -37,9 +38,14 @@ concept mcc_mount_pec_c = requires(T t, const T t_const, XT x, YT y) {
|
||||
// PEC_TYPE_BSPLINE - pure 2D B-spline corrections
|
||||
enum class MccMountDefaultPECType { PEC_TYPE_GEOMETRY, PEC_TYPE_GEOMETRY_BSPLINE, PEC_TYPE_BSPLINE };
|
||||
|
||||
template <MccMountType MOUNT_TYPE>
|
||||
class MccMountDefaultPEC
|
||||
{
|
||||
public:
|
||||
static constexpr MccMountType mountType = MOUNT_TYPE;
|
||||
|
||||
typedef MccAngle coord_t;
|
||||
|
||||
struct pec_result_t {
|
||||
MccAngle dx, dy;
|
||||
};
|
||||
@@ -128,16 +134,13 @@ public:
|
||||
}
|
||||
|
||||
// X and Y axis encoder coordinates
|
||||
template <std::derived_from<MccAngle> XT, std::derived_from<MccAngle> YT>
|
||||
pec_result_t compute(const XT& x, const YT& y)
|
||||
pec_result_t compute(const coord_t& x, const coord_t& y)
|
||||
{
|
||||
static constexpr MccCoordPairKind coord_kind = traits::mcc_type_pair_hash<XT, YT>();
|
||||
|
||||
pec_result_t res{0.0, 0.0};
|
||||
|
||||
std::lock_guard lock(_pecDataMutex);
|
||||
|
||||
if constexpr (coord_kind == MccCoordPairKind::COORDS_KIND_HADEC_APP) {
|
||||
if constexpr (mcc_is_equatorial_mount<MOUNT_TYPE>) { // equatorial
|
||||
if (_pecData.type == MccMountDefaultPECType::PEC_TYPE_GEOMETRY) {
|
||||
const auto cosPhi = std::cos(_phi);
|
||||
const auto sinPhi = std::sin(_phi);
|
||||
@@ -190,7 +193,7 @@ public:
|
||||
res.dx += spl_valX;
|
||||
res.dy += spl_valY;
|
||||
}
|
||||
} else if constexpr (coord_kind == MccCoordPairKind::COORDS_KIND_AZALT) {
|
||||
} else if constexpr (mcc_is_altaz_mount<MOUNT_TYPE>) {
|
||||
} else {
|
||||
static_assert(false, "UNSUPPORTED");
|
||||
}
|
||||
@@ -199,22 +202,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// X and Y apparent equatorial/altazimuthal coordinates (not corrected for refraction)
|
||||
template <std::derived_from<MccAngle> XT, std::derived_from<MccAngle> YT>
|
||||
pec_result_t computeInverse(const XT& x, const YT& y)
|
||||
{
|
||||
static constexpr MccCoordPairKind coord_kind = traits::mcc_type_pair_hash<XT, YT>();
|
||||
|
||||
pec_result_t res{0.0, 0.0};
|
||||
|
||||
if constexpr (coord_kind == MccCoordPairKind::COORDS_KIND_HADEC_APP) {
|
||||
} else if constexpr (coord_kind == MccCoordPairKind::COORDS_KIND_AZALT) {
|
||||
} else {
|
||||
static_assert(false, "UNSUPPORTED");
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
pec_data_t _pecData;
|
||||
|
||||
Reference in New Issue
Block a user