//! SGP4 physical constants from Vallado's "Revisiting Spacetrack Report #3" (2006). //! //! WGS-72 constants used by the SGP4 propagator for compatibility with //! NORAD TLE element sets. WGS-84 constants used for geodetic transforms. use std::f64::consts::PI; // ── WGS-72 constants (SGP4 propagator) ────────────────────── /// Gravitational parameter of Earth (km^3/s^2), WGS-72 value. pub const MU: f64 = 398600.8; /// Earth equatorial radius (km), WGS-72. pub const EARTH_RADIUS_KM: f64 = 6378.135; /// XKE = 60.0 / sqrt(a_E^3 / mu) where a_E in km, mu in km^3/s^2. /// This is sqrt(GM) in units of earth-radii^1.5 / min. pub const XKE: f64 = 0.07436685316871385; /// KE = sqrt(GM_Earth) in earth-radii^1.5 / min (same as XKE for WGS-72). pub const KE: f64 = 0.0743669161; /// Velocity conversion: km/s per (earth-radii/min). pub const VKMPERSEC: f64 = EARTH_RADIUS_KM * XKE / 60.0; /// J2 zonal harmonic, WGS-72. pub const J2: f64 = 1.08262998905e-3; /// J3 zonal harmonic, WGS-72. pub const J3: f64 = -2.53215306e-6; /// J4 zonal harmonic, WGS-72. pub const J4: f64 = -1.61098761e-6; /// J3 / J2 ratio (used frequently in SGP4). pub const J3OJ2: f64 = J3 / J2; /// CK2 = 0.5 * J2 * a_E^2 (in SGP4 normalized units). pub const CK2: f64 = 0.5 * J2; /// CK4 = -3/8 * J4 * a_E^4 (in SGP4 normalized units). pub const CK4: f64 = -0.375 * J4; // ── General constants ──────────────────────────────────────── /// Two pi. pub const TWOPI: f64 = 2.0 * PI; /// Minutes per day. pub const MINUTES_PER_DAY: f64 = 1440.0; /// Seconds per day. pub const SECONDS_PER_DAY: f64 = 86400.0; /// Degrees to radians conversion factor. pub const DEG_TO_RAD: f64 = PI / 180.0; /// Radians to degrees conversion factor. pub const RAD_TO_DEG: f64 = 180.0 / PI; // ── WGS-84 constants (geodetic transforms) ────────────────── /// Earth equatorial radius (km), WGS-84. pub const EARTH_RADIUS_WGS84: f64 = 6378.137; /// Earth polar radius (km), WGS-84. pub const EARTH_POLAR_RADIUS: f64 = 6356.752314245; /// WGS-84 flattening. pub const FLATTENING: f64 = 1.0 / 298.257223563; /// WGS-84 first eccentricity squared: 2f - f^2. pub const EARTH_ECCENTRICITY_SQ: f64 = 2.0 * FLATTENING - FLATTENING * FLATTENING; /// WGS-84 second eccentricity squared: (a^2 - b^2) / b^2. pub const EARTH_ECCENTRICITY_SQ2: f64 = (EARTH_RADIUS_WGS84 * EARTH_RADIUS_WGS84 - EARTH_POLAR_RADIUS * EARTH_POLAR_RADIUS) / (EARTH_POLAR_RADIUS * EARTH_POLAR_RADIUS); /// Earth rotation rate (rad/s), WGS-84. pub const OMEGA_E: f64 = 7.292115e-5; /// Threshold for near-earth vs deep-space branching (minutes). /// Satellites with period >= 225 minutes use SDP4. pub const DEEP_SPACE_THRESHOLD_MIN: f64 = 225.0; /// Small value for floating-point comparisons. pub const SMALL: f64 = 1.0e-12; /// Maximum iterations for Kepler's equation solver. pub const MAX_KEPLER_ITERATIONS: u32 = 10;