pub struct Ellipsoid {
pub a: f64,
pub f: f64,
pub b: f64,
pub e2: f64,
}Expand description
A reference ellipsoid defined by its semi-major axis and flattening.
All four fields are stored for fast access, but only two are
independent (a and f). The derived fields b and e2 are
computed at construction time (in const context) to avoid
repeated work in hot paths.
§Field summary
| Field | Formula | Description |
|---|---|---|
a | (input) | Semi-major axis (equatorial radius), meters |
f | 1 / inv_f | Flattening |
b | a * (1 - f) | Semi-minor axis (polar radius), meters |
e2 | 2f - f^2 | First eccentricity squared |
Fields§
§a: f64Semi-major axis (equatorial radius) in meters.
f: f64Flattening: f = (a - b) / a.
b: f64Semi-minor axis (polar radius) in meters: b = a * (1 - f).
e2: f64First eccentricity squared: e2 = 2f - f^2.
Implementations§
Source§impl Ellipsoid
impl Ellipsoid
Sourcepub const WGS84: Self
pub const WGS84: Self
WGS-84 ellipsoid (EPSG:4326, NIMA TR8350.2).
The World Geodetic System 1984 is the reference frame used by GPS and the default for all rustial coordinate operations.
a = 6 378 137.0 m1/f = 298.257 223 563
Sourcepub const GRS80: Self
pub const GRS80: Self
GRS-80 ellipsoid (EPSG:7019, IUGG 1980).
The Geodetic Reference System 1980 is used by NAD83 (North
America) and ETRS89 (Europe). It is nearly identical to WGS-84
(difference in 1/f is ~0.0001) but is a distinct definition.
a = 6 378 137.0 m1/f = 298.257 222 101
Sourcepub const fn from_a_inv_f(a: f64, inv_f: f64) -> Self
pub const fn from_a_inv_f(a: f64, inv_f: f64) -> Self
Construct an ellipsoid from semi-major axis a (meters) and
inverse flattening inv_f (dimensionless).
Inverse flattening is the standard geodetic convention because
f itself is a very small number (~0.003 for Earth) and
1/f (~298.257) is easier to read and compare across standards.
§Derived quantities
f = 1 / inv_f
b = a * (1 - f)
e2 = 2f - f^2Sourcepub fn second_eccentricity_squared(&self) -> f64
pub fn second_eccentricity_squared(&self) -> f64
Second eccentricity squared: e'2 = (a^2 - b^2) / b^2.
Used in Vincenty geodesic formulae and some map projections.
Sourcepub fn radius_of_curvature_n(&self, lat_rad: f64) -> f64
pub fn radius_of_curvature_n(&self, lat_rad: f64) -> f64
Radius of curvature in the prime vertical (N) at geodetic
latitude lat_rad (radians).
N = a / sqrt(1 - e2 * sin^2(lat))
This is the distance from the surface to the polar axis along the ellipsoid normal. Used in geographic-to-ECEF conversion and UTM projection.