Skip to main content

Crate tpt_sci_astro

Crate tpt_sci_astro 

Source
Expand description

§tpt-sci-astro

Orbital-mechanics and coordinate-frame primitives for the tpt-science pillar, built entirely from scratch on top of the in-house tpt-math-linalg dense linear algebra (no external astrodynamics or geometry wrappers).

The crate implements the classical two-body problem in an Earth-Centered Inertial (ECI) reference frame:

All angles are in radians. The model assumes an ideal point-mass central body for the pure two-body propagation; each perturbation above is an independent first-order secular add-on (not a combined integrated force model), so short-periodic oscillations are not captured and the perturbations are not accumulated together automatically.

§Examples

use tpt_math_linalg::tpt_math_linalg_dense::{DVector, DMatrix};
use tpt_sci_astro::OrbitalElements;

// A unit circular orbit about a unit-mass body.
let el = OrbitalElements::new(1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0).unwrap();
let (r, _v) = el.state_vector();
assert!((r.norm() - 1.0).abs() < 1e-9);

Licensed under either of MIT or Apache-2.0 at your option.

Structs§

OrbitalElements
A classical (Keplerian) set of orbital elements describing an elliptical orbit in an Earth-Centered Inertial (ECI) frame.

Enums§

AstroError
Errors produced by the astrodynamics primitives.

Constants§

ASTRONOMICAL_UNIT_KM
One astronomical unit, in km.
EARTH_ATM_H0_KM
Reference altitude (km) for EARTH_ATM_RHO0_KG_M3 / EARTH_ATM_SCALE_HEIGHT_KM.
EARTH_ATM_RHO0_KG_M3
Reference atmospheric density (kg/m³) for the single-band exponential Earth atmosphere model, evaluated at EARTH_ATM_H0_KM.
EARTH_ATM_SCALE_HEIGHT_KM
Atmospheric scale height (km) for the ~400 km exponential density band (see EARTH_ATM_RHO0_KG_M3).
EARTH_J2
Earth’s second zonal harmonic J₂ (dimensionless), the leading oblateness term that drives nodal regression and apsidal precession.
EARTH_J4
Earth’s fourth zonal harmonic J₄ (dimensionless), the next zonal oblateness term after J₂.
EARTH_MU
Gravitational parameter of the Earth, μ = GM, in km³·s⁻².
EARTH_RADIUS_EQ
Earth’s equatorial radius Rₑ in km, the reference length for the J₂ perturbation (the perturbation scales as (Rₑ/p)²).
MOON_DISTANCE_KM
Mean Earth-Moon distance, in km.
MOON_MU
Gravitational parameter of the Moon, μ_Moon = GM_Moon, in km³·s⁻².
SOLAR_PRESSURE_1AU
Solar radiation pressure at 1 AU, in N/m² (solar constant / speed of light, ≈ 1361 W/m² / 2.998e8 m/s).
SUN_MU
Gravitational parameter of the Sun, μ☉ = GM☉, in km³·s⁻².

Functions§

atmospheric_density
Exponential atmospheric density model, ρ(h) = ρ0 · exp(-(h - h0) / H).
cross3
Cross product of two 3-vectors, a × b.
eccentric_to_true
Convert an eccentric anomaly E to a true anomaly nu for eccentricity e.
in_earth_shadow
Cylindrical Earth-shadow (eclipse) test.
perifocal_to_eci
The 3×3 rotation matrix Q that maps perifocal-frame coordinates to ECI.
solve_kepler
Solve Kepler’s equation M = E - e·sin(E) for E via Newton iteration.
srp_acceleration
Cannonball-model solar radiation pressure acceleration magnitude, in km/s².
true_to_eccentric
Convert a true anomaly nu to an eccentric anomaly E for eccentricity e.