Basic coordinate construction and type-safe coordinate operations.
#include <iostream>
using namespace qtty::literals;
int main() {
std::cout << "=== Siderust Basic Coordinates Example ===\n\n";
std::cout << "Earth heliocentric ecliptic: " << earth << '\n';
std::cout << " distance from Sun: " << earth.distance() << "\n\n";
100000.0);
std::cout << "Moon geocentric equatorial: " << moon << '\n';
std::cout <<
" distance from Earth: " << moon.
distance() <<
"\n\n";
std::cout << "Polaris direction: " << polaris << "\n\n";
auto betelgeuse_distance = qtty::LightYear(500.0).
to<qtty::AstronomicalUnit>();
betelgeuse_distance);
std::cout << "Betelgeuse: " << betelgeuse << "\n\n";
std::cout << "Zenith (horizontal): " << zenith << '\n';
5000.0_km);
std::cout << "Cloud at zenith: " << cloud << "\n\n";
0.707);
std::cout << "Cartesian: " << cart_pos << '\n';
std::cout << "Spherical: " << sph_pos << '\n';
std::cout << "Back to cartesian: " << sph_pos.to_cartesian() << "\n\n";
std::cout << "Different centers cannot be subtracted directly:\n";
std::cout << " " << helio << '\n';
std::cout << " " << geo << '\n';
std::cout << "Separation (same type): " << sep << "\n\n";
std::cout << "Centers: Barycentric, Heliocentric, Geocentric, Topocentric, Bodycentric\n";
std::cout << "Frames: EclipticMeanJ2000, EquatorialMeanJ2000, Horizontal, ICRS, ECEF\n";
return 0;
}
Umbrella header for the siderust C++ wrapper library.
A 3D Cartesian position, compile-time tagged by center, frame, unit.
U distance_to(const Position &other) const
spherical::Position< C, F, U > to_spherical() const
Convert this cartesian position to a spherical Position<C,F,U>.
A direction on the celestial sphere, compile-time tagged by frame.
auto to(const Time< TT, JD > &jd) const -> decltype(this->template to_frame< Target >(jd))
Shorthand: .to<Target>(jd) (calls to_frame).
A spherical position (direction + distance), compile-time tagged.