...
This commit is contained in:
parent
0f955b3c91
commit
1a4d998141
@ -300,7 +300,7 @@ public:
|
|||||||
requires(mcc_celestial_point_c<T> || mcc_eqt_hrz_coord_c<T>)
|
requires(mcc_celestial_point_c<T> || mcc_eqt_hrz_coord_c<T>)
|
||||||
{
|
{
|
||||||
// for small corrections only!!!
|
// for small corrections only!!!
|
||||||
auto ret = computePCM(std::move(app_pt), result);
|
auto ret = computePCM(std::move(app_pt), result, hw_pt);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include <numbers>
|
#include <numbers>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include "mcc_traits.h"
|
||||||
|
|
||||||
namespace mcc::utils
|
namespace mcc::utils
|
||||||
{
|
{
|
||||||
@ -313,4 +314,45 @@ static std::string AZZD_rad2sxg(double az, double zd, std::string_view delim = "
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// string to pair of angles
|
||||||
|
// " 12.3453467,102.4345346"
|
||||||
|
// "12:43:23.423, 102:43:12.124"
|
||||||
|
// " 12.3453467, 102:43:12.124 "
|
||||||
|
template <mcc::traits::mcc_input_char_range R>
|
||||||
|
std::pair<double, double> parseAnglePair(R&& str, bool hms1 = false, bool hms2 = false, std::string_view delim = ",")
|
||||||
|
{
|
||||||
|
std::pair<double, double> res{std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()};
|
||||||
|
auto found1 = std::ranges::search(std::forward<R>(str), delim);
|
||||||
|
|
||||||
|
if (found1.empty()) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string s1, s2;
|
||||||
|
std::ranges::copy(str.begin(), found1.begin(), std::back_inserter(s1));
|
||||||
|
|
||||||
|
auto rem_len = std::distance(found1.end(), str.end());
|
||||||
|
if (!rem_len) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto found2 = std::ranges::search(found1.end(), str.end(), delim.begin(), delim.end());
|
||||||
|
if (found2.empty()) {
|
||||||
|
std::ranges::copy(found1.end(), str.end(), std::back_inserter(s2));
|
||||||
|
} else {
|
||||||
|
std::ranges::copy(found1.end(), found2.end(), std::back_inserter(s2));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto vo1 = parsAngleString(s1, hms1);
|
||||||
|
if (vo1) {
|
||||||
|
auto vo2 = parsAngleString(s2, hms2);
|
||||||
|
if (vo2) {
|
||||||
|
res = {vo1.value(), vo2.value()};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace mcc::utils
|
} // namespace mcc::utils
|
||||||
|
|||||||
@ -140,5 +140,14 @@ int main()
|
|||||||
erfa.refractionCorrection(cp, &dZ);
|
erfa.refractionCorrection(cp, &dZ);
|
||||||
std::cout << "dZ(" << mcc::MccAngle(cp.Y).degrees() << ") = " << mcc::MccAngle(dZ).arcsecs() << "\n";
|
std::cout << "dZ(" << mcc::MccAngle(cp.Y).degrees() << ") = " << mcc::MccAngle(dZ).arcsecs() << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "\n\n";
|
||||||
|
|
||||||
|
std::string sc2{" 11:34:21.21 , 104.4567892"};
|
||||||
|
|
||||||
|
auto p2 = mcc::utils::parseAnglePair(sc2);
|
||||||
|
|
||||||
|
std::cout << p2.first << ", " << p2.second << "\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user