Coordinate transformation workflow across Siderust C++ types.
#include <cmath>
#include <iostream>
using AU = qtty::AstronomicalUnit;
int main() {
std::cout << "=== Coordinate Transformations Example ===\n\n";
std::cout << "Reference epoch: " << jd << "\n\n";
std::cout << "Heliocentric ecliptic: " << pos_ecliptic << '\n';
<< '\n';
std::cout << " -> ICRS: "
auto earth_helio = ephemeris::earth_heliocentric(jd);
std::cout << "Earth (heliocentric): " << earth_helio << '\n';
std::cout <<
" -> geocentric (origin): " << earth_helio.to_center<
Geocentric>(jd) <<
'\n';
auto mars_helio = ephemeris::mars_heliocentric(jd);
std::cout << "Mars (heliocentric): " << mars_helio << '\n';
std::cout <<
" -> geocentric: " << mars_helio.to_center<
Geocentric>(jd) <<
"\n\n";
std::cout << "Mars geocentric equatorial: " << mars_geo_equ << '\n';
std::cout << " (via .transform<Geocentric, EquatorialMeanJ2000>)\n\n";
auto earth_bary = ephemeris::earth_barycentric(jd);
std::cout << "Earth barycentric: " << earth_bary << '\n';
std::cout <<
" -> geocentric: " << earth_bary.to_center<
Geocentric>(jd) <<
'\n';
auto mars_geo_from_bary = ephemeris::mars_barycentric(jd).to_center<
Geocentric>(jd);
std::cout << "Mars geocentric (from bary): " << mars_geo_from_bary << "\n\n";
std::cout << "Catalog star (barycentric ICRS): " << star_icrs << '\n';
<< "\n\n";
.transform<Heliocentric, EclipticMeanJ2000>(jd);
std::cout << "Mars round-trip: " << recovered << '\n';
std::cout << " |Δx| = " << std::abs(mars_helio.x().value() - recovered.x().value()) << " AU\n";
return 0;
}
tempoch::EncodedTime< Scale, Format > Time
Umbrella header for the siderust C++ wrapper library.
A 3D Cartesian position, compile-time tagged by center, frame, unit.
std::enable_if_t< centers::has_center_transform_v< C, TargetC >, Position< TargetC, F, U > > to_center(const Time< TT, JD > &jd) const
Transform this position to a different reference center (same frame).
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Position< C, Target, U > > to_frame(const Time< TT, JD > &jd) const
Transform this position to a different reference frame (same center).
Geocenter (zero-cost, Params = void).
Mean equatorial of J2000.0 (FK5-aligned).