Skip to content

rsw_quaternion

Defined in: lib.rs:61

fn rsw_quaternion(pos: &nalgebra::Vector3<f64>, vel: &nalgebra::Vector3<f64>) -> [Option<nalgebra::UnitQuaternion<f64>>](https://doc.rust-lang.org/std/option/enum.Option.html)

Compute the RSW (Radial / Along-track / Cross-track) orbital frame quaternion from satellite position and velocity in a simple Earth-centered inertial frame.

RSW basis (standard Vallado convention, right-handed):

  • R̂ = normalize(r) — radial (earth-to-satellite)
  • Ŵ = normalize(r × v) — cross-track (orbit normal)
  • Ŝ = Ŵ × R̂ — along-track (circular prograde: roughly +v̂ direction)

Returns the RSW-to-ECI rotation as a unit quaternion, or None if position/velocity are zero or parallel (degenerate orbit).

This differs from the pre-redesign lvlh_quaternion which used axis order [InTrack, CrossTrack, Radial]. The new RSW convention is [Radial, Along-track, Cross-track]. The returned quaternion has different numerical values; call sites that pin Lvlh values must be updated to new RSW-basis expectations.