...
This commit is contained in:
parent
a496c5cc54
commit
a9d52aad0e
@ -3,11 +3,6 @@
|
|||||||
#include "mcc_traits.h"
|
#include "mcc_traits.h"
|
||||||
#include "utils.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)
|
constexpr double operator""_rads(long double val) // angle in radians (no conversion)
|
||||||
{
|
{
|
||||||
return val;
|
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"
|
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()) {
|
if (res.has_value()) {
|
||||||
return res.value() * std::numbers::pi / 180.0;
|
return res.value() * std::numbers::pi / 180.0;
|
||||||
} else {
|
} 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()) {
|
if (res.has_value()) {
|
||||||
return res.value() * std::numbers::pi / 180.0;
|
return res.value() * std::numbers::pi / 180.0;
|
||||||
} else {
|
} 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
|
// tags for MccCoordinate class construction
|
||||||
|
|
||||||
struct MccRadianTag {
|
struct MccRadianTag {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "../mcc_coord.h"
|
||||||
#include "../mount_astrom.h"
|
#include "../mount_astrom.h"
|
||||||
|
|
||||||
|
|
||||||
@ -102,5 +103,23 @@ int main(int argc, char* argv[])
|
|||||||
"comp time for {} coordinate transf = {}\n", N,
|
"comp time for {} coordinate transf = {}\n", N,
|
||||||
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - now));
|
std::chrono::duration_cast<std::chrono::milliseconds>(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;
|
return ecode;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user