...
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
/* MOUNT CONTROL COMPONENTS LIBRARY */
|
||||
|
||||
/* PROHIBITED ZONE IMPLEMENTATION */
|
||||
/* MOUNT CONTROL COMPONENTS LIBRARY */
|
||||
|
||||
|
||||
/* PROHIBITED ZONE IMPLEMENTATION */
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <string_view>
|
||||
@@ -37,7 +40,8 @@ public:
|
||||
|
||||
static constexpr MccAltLimitKind altLimitKind = KIND;
|
||||
|
||||
typedef MccAngle coord_t;
|
||||
typedef double coord_t;
|
||||
// typedef MccAngle coord_t;
|
||||
// floating-point time duration (seconds)
|
||||
typedef std::chrono::duration<double> duration_t;
|
||||
|
||||
@@ -53,9 +57,10 @@ public:
|
||||
: _altLimit(alt_limit), _latitude(lat), _abs_lat(std::abs(_latitude)), _lat_lim(pi2 - _abs_lat)
|
||||
{
|
||||
_lat_lim = pi2 - _abs_lat;
|
||||
_altLimit.normalize<MccAngle::NORM_KIND_90_90>();
|
||||
// _altLimit.normalize<MccAngle::NORM_KIND_90_90>();
|
||||
_altLimit = MccAngle(_altLimit).normalize<MccAngle::NORM_KIND_90_90>();
|
||||
|
||||
using astrom_engine_t = decltype(*astrom_engine);
|
||||
using astrom_engine_t = std::remove_cvref_t<decltype(*astrom_engine)>;
|
||||
using astrom_coord_t = typename astrom_engine_t::coord_t;
|
||||
|
||||
static_assert(std::convertible_to<coord_t, astrom_coord_t>,
|
||||
@@ -212,25 +217,32 @@ public:
|
||||
double cos_ha =
|
||||
(std::sin(_altLimit) - std::sin(dec) * std::sin(_latitude)) / std::cos(dec) / std::cos(_latitude);
|
||||
|
||||
|
||||
if (cos_ha > 1.0) { // no intersection
|
||||
// compute culmination points?
|
||||
return false;
|
||||
}
|
||||
|
||||
double cosA = -sin(dec) * std::cos(_latitude) + std::cos(dec) * std::sin(_latitude) * cos_ha;
|
||||
double cosA = -std::sin(dec) * std::cos(_latitude) + std::cos(dec) * std::sin(_latitude) * cos_ha;
|
||||
cosA /= std::cos(_altLimit);
|
||||
|
||||
double sinA = std::cos(dec) * sqrt(1.0 - cos_ha * cos_ha) / cos(_altLimit);
|
||||
|
||||
if constexpr (KIND ==
|
||||
MccAltLimitKind::MIN_ALT_LIMIT) { // the closest time point is one after upper culmination
|
||||
az = std::acos(cosA);
|
||||
az = -std::acos(cosA);
|
||||
// az = atan2(cosA, sinA);
|
||||
} else if constexpr (KIND == MccAltLimitKind::MAX_ALT_LIMIT) { // the closest time point is one before upper
|
||||
// culmination
|
||||
az = -std::acos(cosA);
|
||||
az = std::acos(cosA);
|
||||
// az = atan2(cosA, sinA);
|
||||
}
|
||||
|
||||
_coord2coord(MccCoordPairKind::COORDS_KIND_AZALT, az, _altLimit, target.time_point, int_point.coordPairKind,
|
||||
int_point.x, int_point.y);
|
||||
|
||||
int_point.x = az;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -238,7 +250,7 @@ private:
|
||||
coord_t _altLimit, _latitude, _abs_lat, _lat_lim;
|
||||
|
||||
// wrapper function
|
||||
std::function<coord_t(MccCoordPairKind, coord_t, coord_t, time_point_t, MccCoordPairKind, coord_t&, coord_t&)>
|
||||
std::function<void(MccCoordPairKind, coord_t, coord_t, time_point_t, MccCoordPairKind, coord_t&, coord_t&)>
|
||||
_coord2coord{};
|
||||
|
||||
bool doesObjectReachZone(const coord_t& dec_app)
|
||||
@@ -322,7 +334,8 @@ private:
|
||||
|
||||
time_ang /= mcc_sideral_to_UT1_ratio; // to UT1 time scale
|
||||
|
||||
return duration_t{time_ang.seconds()};
|
||||
return duration_t{MccAngle(time_ang).seconds()};
|
||||
// return duration_t{time_ang.seconds()};
|
||||
}
|
||||
|
||||
duration_t compute(traits::mcc_mount_telemetry_data_c auto const& telemetry_data, bool before_upper_culm)
|
||||
|
||||
Reference in New Issue
Block a user