Sgp4Elements
Defined in: elements.rs:49
pub struct Sgp4ElementsSGP4 mean orbital element set — a validated mean-element record.
Holding a Sgp4Elements guarantees the elements are physically usable:
every field is finite, the mean motion is positive, and the eccentricity is
in [0, 1). Build one with try_new(Self::try_new) (or TryFrom) from a
Sgp4ElementsFields; the text parsers (crate::tle, crate::omm) go
through the same path, so a parsed element set is always valid. Read the
fields back with fields(Self::fields).
The elements are SGP4 mean elements (Brouwer-Kozai), not osculating Keplerian elements — propagate them with SGP4 rather than converting to a classical orbit. No allocator required.
Methods
Section titled “Methods”try_new()
Section titled “try_new()”fn try_new(fields: Sgp4ElementsFields) -> [Result<Self, ElementsError>](https://doc.rust-lang.org/std/result/enum.Result.html)
Validate fields and wrap them as a Sgp4Elements.
Returns an ElementsError if any field is non-finite, the mean motion
is not strictly positive, or the eccentricity is outside [0, 1). Angles
are only checked for finiteness (not normalized — SGP4 reduces them mod
2π), and bstar may be negative (it occurs in real element sets).
fields()
Section titled “fields()”fn fields(&self) -> &Sgp4ElementsFields
Read-only view of the validated fields.
to_fields()
Section titled “to_fields()”fn to_fields(&self) -> Sgp4ElementsFields
Copy out the validated fields.
semi_major_axis()
Section titled “semi_major_axis()”fn semi_major_axis(&self, mu: f64) -> f64
Semi-major axis [km] from mean motion: a = (μ/n²)^(1/3).
A rough two-body estimate for display only — it ignores the J2 secular correction baked into the SGP4 (Kozai) mean motion, so it is not the semi-major axis SGP4 itself uses.
period()
Section titled “period()”fn period(&self) -> f64
Orbital period [s] from the mean motion: 2π / n.
Positive — the mean motion is a validated, strictly-positive invariant
(so the period never goes negative or NaN; an absurdly tiny mean motion
could still overflow to +∞). Needs no mu; this is the conventional
period reported for a TLE/OMM.