This commit is contained in:
2026-03-26 17:40:36 +03:00
parent 4b0569bfea
commit a8275f3786
6 changed files with 289 additions and 21 deletions

View File

@@ -19,6 +19,9 @@ namespace mcc
{
static constexpr double MCC_DEGRESS_TO_RADS = std::numbers::pi / 180.0;
static constexpr double MCC_ARCMINS_TO_RADS = MCC_DEGRESS_TO_RADS / 60.0;
static constexpr double MCC_ARCSECS_TO_RADS = MCC_DEGRESS_TO_RADS / 3600.0;
static constexpr double MCC_RADS_TO_DEGRESS = 1.0 / MCC_DEGRESS_TO_RADS;
static constexpr double MCC_HALF_PI = std::numbers::pi / 2.0;

View File

@@ -100,13 +100,6 @@ public:
static_assert(!std::is_void_v<ref_coordpair_t>, "UNSUPPORTED MOUNT TYPE!");
struct table_elem_t {
double target_colon, target_colat;
double hw_colon, hw_colat;
double colon_res, colat_res; // target - hw
};
struct table_t {
std::vector<double> target_colon{}, target_colat{};
std::vector<double> hw_colon{}, hw_colat{};
@@ -137,31 +130,65 @@ public:
double tolerance{1.0E-6}; //
};
MccError addPoint(mcc_skypoint_c auto target_coords, mcc_coord_pair_c auto const& hw_counts)
requires(std::decay_t<decltype(hw_counts)>::pairKind == MccCoordPairKind::COORDS_KIND_XY)
template <mcc_coord_pair_c TAG_T, mcc_coord_pair_c HW_T>
MccError addPoint(TAG_T target_coords, HW_T const& hw_counts)
requires(TAG_T::pairKind == ref_coordpair_t::pairKind && HW_T::pairKind == MccCoordPairKind::COORDS_KIND_XY)
{
auto err = target_coords.to(ref_coordpair_t::pairKind, hw_counts.epoch());
if (err) {
return mcc_deduced_err(err, MccDefaultPCMErrorCode::ERROR_CCTE);
}
//
// TODO: target_coords.epoch() != hw_counts.epoch() ?!!!!!!!!!
//
// _table.push_back({target_coords.co_lon(), target_coords.co_lat(), hw_counts.x(), hw_counts.y(),
// target_coords.co_lon() - hw_counts.x(), target_coords.co_lat() - hw_counts.y()});
_tableEpoch.emplace_back(hw_counts.epoch());
_table.target_colon.emplace_back(target_coords.co_lon());
_table.target_colat.emplace_back(target_coords.co_lon());
_table.target_colon.emplace_back(target_coords.x());
_table.target_colat.emplace_back(target_coords.y());
_table.hw_colon.emplace_back(hw_counts.x());
_table.hw_colat.emplace_back(hw_counts.y());
_table.colon_res.emplace_back(target_coords.co_lon() - hw_counts.x());
_table.colat_res.emplace_back(target_coords.co_lat() - hw_counts.y());
_table.colon_res.emplace_back((double)target_coords.x() - (double)hw_counts.x());
_table.colat_res.emplace_back((double)target_coords.y() - (double)hw_counts.y());
return {};
}
MccError addPoint(mcc_skypoint_c auto const& target_coords, mcc_coord_pair_c auto const& hw_counts)
requires(std::decay_t<decltype(hw_counts)>::pairKind == MccCoordPairKind::COORDS_KIND_XY)
{
ref_coordpair_t cp;
cp.setEpoch(hw_counts.epoch());
auto err = target_coords.to(cp);
if (err) {
return mcc_deduced_err(err, MccDefaultPCMErrorCode::ERROR_CCTE);
}
return addPoint(cp, hw_counts);
// auto err = target_coords.to(ref_coordpair_t::pairKind, hw_counts.epoch());
// if (err) {
// return mcc_deduced_err(err, MccDefaultPCMErrorCode::ERROR_CCTE);
// }
// _tableEpoch.emplace_back(hw_counts.epoch());
// _table.target_colon.emplace_back(target_coords.co_lon());
// _table.target_colat.emplace_back(target_coords.co_lat());
// _table.hw_colon.emplace_back(hw_counts.x());
// _table.hw_colat.emplace_back(hw_counts.y());
// _table.colon_res.emplace_back(target_coords.co_lon() - hw_counts.x());
// _table.colat_res.emplace_back(target_coords.co_lat() - hw_counts.y());
// return {};
}
const table_t& getTable() const
{
return _table;
}
template <mcc_coord_pair_c TAG_T, mcc_coord_pair_c HW_T>
MccError getPoint(size_t idx, std::tuple<TAG_T, HW_T>& point)
@@ -552,8 +579,8 @@ protected:
for (size_t i = 0; i < numberOfPoints(); ++i) {
result.colon_res[i] = _table.colon_res[i] - result.model_colon[i]; // = target - model
result.colat_res[i] = _table.colat_res[i] - result.model_colat[i]; // = target - model
result.model_colon[i] += _table.hw_colon[i]; // == hw + fitted_pcmX
result.model_colat[i] += _table.hw_colat[i]; // == hw + fitted_pcmY
// result.model_colon[i] += _table.hw_colon[i]; // == hw + fitted_pcmX
// result.model_colat[i] += _table.hw_colat[i]; // == hw + fitted_pcmY
}
return result;