This commit is contained in:
2025-08-09 13:25:52 +03:00
parent b99263a014
commit 22097610f9
5 changed files with 47 additions and 17 deletions

View File

@@ -200,6 +200,39 @@ public:
}
}
// compute intersection point for the case of sideral-like moving
bool intersectPoint(traits::mcc_celestial_point_c auto const& target, traits::mcc_celestial_point_c auto& int_point)
{
coord_t ha, dec, az;
_coord2coord(target.coordPairKind, target.x, target.y, target.time_point,
MccCoordPairKind::COORDS_KIND_HADEC_APP, ha, dec);
// compute HA for intersection point
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;
cosA /= std::cos(_altLimit);
if constexpr (KIND ==
MccAltLimitKind::MIN_ALT_LIMIT) { // the closest time point is one after upper culmination
az = std::acos(cosA);
} else if constexpr (KIND == MccAltLimitKind::MAX_ALT_LIMIT) { // the closest time point is one before upper
// culmination
az = -std::acos(cosA);
}
_coord2coord(MccCoordPairKind::COORDS_KIND_AZALT, az, _altLimit, target.time_point, int_point.coordPairKind,
int_point.x, int_point.y);
return true;
}
private:
coord_t _altLimit, _latitude, _abs_lat, _lat_lim;
@@ -274,13 +307,14 @@ private:
}
double ha;
// WARNING: what about south hemisphere?!!!
if (before_upper_culm) {
ha = -std::acos(cos_ha); // HA before upper culmination
} else {
ha = std::acos(cos_ha); // HA after upper culmination!!
}
MccAngle time_ang = ha - ha_app; // in sideral time scale
coord_t time_ang = ha - ha_app; // in sideral time scale
if (time_ang < 0.0) { // next day
time_ang += pi2;