siderust-cpp 0.8.0
Header-only C++ wrapper for siderust
Loading...
Searching...
No Matches
bodycentric_transforms.hpp File Reference

Body-centric coordinate transformations. More...

#include "../ffi_core.hpp"
#include "../orbital_center.hpp"
#include "../time.hpp"
#include "cartesian.hpp"
#include <cstdint>
Include dependency graph for bodycentric_transforms.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  siderust::BodycentricPos< F, U >
 Result of a body-centric coordinate transformation. More...
 

Namespaces

namespace  siderust
 

Functions

template<typename C , typename F , typename U >
BodycentricPos< F, U > siderust::to_bodycentric (const cartesian::Position< C, F, U > &pos, const BodycentricParams &params, const Time< TT, JD > &jd)
 Transform a position to body-centric coordinates.
 

Detailed Description

Body-centric coordinate transformations.

Mirrors Rust's ToBodycentricExt and FromBodycentricExt traits:

  • to_bodycentric(pos, params, jd) — free function transforming a Geocentric/Heliocentric/Barycentric position to one centered on the orbiting body described by params.
  • BodycentricPos<F,U>::to_geocentric(jd) — inverse transform back to geocentric.

The transform algorithm (mirroring Rust):

  1. Propagate the body's Keplerian orbit to JD → position in the orbit's reference center.
  2. Convert that position to match the source center (via VSOP87 offsets).
  3. bodycentric = input - body_in_source_center

Usage

#include <siderust/siderust.hpp> // or just this file
using namespace siderust;
using namespace siderust::frames;
using namespace siderust::centers;
using qtty::AstronomicalUnit;
auto jd = Time<TT, JD>::J2000();
// ISS-like geocentric orbit
KeplerianOrbit iss_orbit{0.0000426_au, Eccentricity{0.001}, 51.6_deg,
0.0_deg, 0.0_deg, 0.0_deg, jd};
BodycentricParams iss_params = BodycentricParams::geocentric(iss_orbit);
// Moon's approximate geocentric position
moon_geo( 0.00257, 0.0, 0.0);
// Moon as seen from ISS
auto moon_from_iss = to_bodycentric(moon_geo, iss_params, jd);
// Round-trip back to geocentric
auto recovered = moon_from_iss.to_geocentric(jd);
tempoch::EncodedTime< Scale, Format > Time
Definition time.hpp:36
BodycentricPos< F, U > to_bodycentric(const cartesian::Position< C, F, U > &pos, const BodycentricParams &params, const Time< TT, JD > &jd)
Transform a position to body-centric coordinates.
Umbrella header for the siderust C++ wrapper library.
Parameters for a body-centric coordinate system.
A 3D Cartesian position, compile-time tagged by center, frame, unit.

Definition in file bodycentric_transforms.hpp.