pub struct Spheroid {
pub equatorial_radius: f64,
pub flattening: f64,
}Expand description
Reference ellipsoid for geographic coordinate systems.
Field semantics match Boost’s srs::spheroid<T>
(boost/geometry/srs/spheroid.hpp:49-112), except the second
stored value is the flattening instead of the polar radius — the
two forms are interconvertible via polar_radius /
flattening but f is what the geodesic formulas actually take
as input.
§Examples
use geometry_cs::Spheroid;
let s = Spheroid::WGS84;
assert_eq!(s.equatorial_radius, 6_378_137.0);
// The WGS84 polar radius is ~6 356 752.3 m.
assert!((s.polar_radius() - 6_356_752.314_245).abs() < 0.01);Fields§
§equatorial_radius: f64Equatorial (semi-major) radius a, in metres.
flattening: f64Flattening f = (a − b) / a, dimensionless.
Implementations§
Source§impl Spheroid
impl Spheroid
Sourcepub const WGS84: Self
pub const WGS84: Self
The WGS84 reference ellipsoid.
Equatorial radius and flattening per the WGS84 defining
parameters; matches the default-constructed
srs::spheroid<RadiusType> in
boost/geometry/srs/spheroid.hpp:62-69, which seeds
m_a = 6_378_137.0 and m_b = 6_356_752.314_245_179_3.
Sourcepub fn polar_radius(&self) -> f64
pub fn polar_radius(&self) -> f64
Semi-minor axis b = a · (1 − f), in metres.
Counterpart to srs::spheroid<T>::get_radius<2>() in
boost/geometry/srs/spheroid.hpp:78-92.
Sourcepub fn eccentricity_squared(&self) -> f64
pub fn eccentricity_squared(&self) -> f64
First eccentricity squared e² = 2f − f².
Used by the geodesic strategies (Andoyer / Vincenty / Thomas)
in boost/geometry/strategies/geographic/*.hpp. The identity
e² = 2f − f² follows from b = a(1 − f) and
e² = (a² − b²) / a².