diff --git a/cxx/mcc_coord.h b/cxx/mcc_coord.h index 6e4a895..550c74e 100644 --- a/cxx/mcc_coord.h +++ b/cxx/mcc_coord.h @@ -3,11 +3,6 @@ #include "mcc_traits.h" #include "utils.h" -namespace mcc -{ - -/* MCC-LIBRARY COORDINATES REPRESENTATION DEFINITIONS AND CLASS */ - constexpr double operator""_rads(long double val) // angle in radians (no conversion) { return val; @@ -20,7 +15,7 @@ constexpr double operator""_degs(long double val) // angle in degrees constexpr double operator""_dms(const char* s, size_t size) // as a string "DEGREES:MINUTES:SECONDS" { - auto res = utils::parsAngleString(std::span{s, size}); + auto res = mcc::utils::parsAngleString(std::span{s, size}); if (res.has_value()) { return res.value() * std::numbers::pi / 180.0; } else { @@ -28,9 +23,9 @@ constexpr double operator""_dms(const char* s, size_t size) // as a string "DEG } } -constexpr double operator""_hms(const char* s, size_t size) // as a string "HOURS:MINUTES:SECONDS" +constexpr double operator""_hms(const char* s, size_t len) // as a string "HOURS:MINUTES:SECONDS" { - auto res = utils::parsAngleString(std::span{s, size}, true); + auto res = mcc::utils::parsAngleString(std::span{s, len}, true); if (res.has_value()) { return res.value() * std::numbers::pi / 180.0; } else { @@ -39,6 +34,13 @@ constexpr double operator""_hms(const char* s, size_t size) // as a string "HOU } +namespace mcc +{ + +/* MCC-LIBRARY COORDINATES REPRESENTATION DEFINITIONS AND CLASS */ + + + // tags for MccCoordinate class construction struct MccRadianTag { diff --git a/cxx/tests/astrom_test.cpp b/cxx/tests/astrom_test.cpp index ea87971..295f6f2 100644 --- a/cxx/tests/astrom_test.cpp +++ b/cxx/tests/astrom_test.cpp @@ -1,6 +1,7 @@ #include #include +#include "../mcc_coord.h" #include "../mount_astrom.h" @@ -102,5 +103,23 @@ int main(int argc, char* argv[]) "comp time for {} coordinate transf = {}\n", N, std::chrono::duration_cast(std::chrono::system_clock::now() - now)); + + std::cout << "\n\n\nMccCoordinate class test:\n"; + + mcc::MccCoordinate ra("12:00:00", mcc::mcc_hms); + + std::cout << "sin(12h) = " << std::sin(ra) << "\n"; + std::cout << "cos(12h) = " << std::cos(ra) << "\n"; + + ra = "18:00:00"_hms; + std::cout << "sin(18h) = " << std::sin(ra) << "\n"; + std::cout << "cos(18h) = " << std::cos(ra) << "\n"; + + ra = mcc::MccCoordinate{45.0, mcc::mcc_degrees}; + std::cout << "sin(45) = " << std::sin(ra) << "\n"; + std::cout << "cos(45) = " << std::cos(ra) << "\n"; + + std::cout << ra.sexagesimal(false, 4) << "\n"; + return ecode; }