Skip to content

KeplerianElements

Defined in: kepler.rs:82

pub struct KeplerianElements {
pub semi_major_axis: f64,
pub eccentricity: f64,
pub inclination: f64,
pub raan: f64,
pub argument_of_periapsis: f64,
pub true_anomaly: f64,
}

Classical Keplerian orbital elements.

semi_major_axis: f64

Semi-major axis [km]


eccentricity: f64

Eccentricity (dimensionless)


inclination: f64

Inclination [rad]


raan: f64

Right ascension of ascending node (RAAN) [rad]


argument_of_periapsis: f64

Argument of periapsis [rad]


true_anomaly: f64

True anomaly [rad]


fn from_state_vector(pos: &Vector3<f64>, vel: &Vector3<f64>, mu: f64) -> Self

Convert a Cartesian state vector (position, velocity) to Keplerian elements.

  • pos - Position vector [km]
  • vel - Velocity vector [km/s]
  • mu - Gravitational parameter [km^3/s^2]

fn to_state_vector(&self, mu: f64) -> (Vector3<f64>, Vector3<f64>)

Convert Keplerian elements to a Cartesian state vector (position, velocity).

A tuple of (position [km], velocity [km/s])


fn from_mean_anomaly(semi_major_axis: f64, eccentricity: f64, inclination: f64, raan: f64, argument_of_periapsis: f64, mean_anomaly: f64) -> Self

Create Keplerian elements from mean anomaly (converting to true anomaly internally).

This is useful when working with TLE data which provides mean anomaly.


fn period(&self, mu: f64) -> f64

Orbital period [s]: T = 2π√(a³/μ)


fn energy(&self, mu: f64) -> f64

Specific orbital energy [km²/s²]: ε = -μ/(2a)