Skip to main content

geometry_strategy/geographic/
inverse.rs

1//! Shared result shape for inverse geodesic formulas.
2//!
3//! Mirrors `boost::geometry::formula::result_inverse<CT>` from
4//! `formulas/result_inverse.hpp:25-57`.
5
6/// Distance and endpoint azimuths produced by an inverse geodesic solution.
7///
8/// Angular values are radians; distance uses the spheroid radius unit.
9/// Mirrors `formula::result_inverse` from `formulas/result_inverse.hpp:31-48`,
10/// with an additional convergence flag for iterative Rust solvers.
11#[derive(Debug, Clone, Copy, PartialEq)]
12pub struct InverseResult {
13    /// Shortest geodesic distance.
14    pub distance: f64,
15    /// Forward azimuth at the first point.
16    pub azimuth: f64,
17    /// Final/reverse azimuth at the second point.
18    pub reverse_azimuth: f64,
19    /// Whether the inverse iteration met its angular convergence threshold.
20    pub converged: bool,
21    /// Reduced geodesic length in the spheroid's radius unit.
22    pub reduced_length: f64,
23    /// Dimensionless forward geodesic scale.
24    pub geodesic_scale: f64,
25}
26
27impl Default for InverseResult {
28    fn default() -> Self {
29        Self {
30            distance: 0.0,
31            azimuth: 0.0,
32            reverse_azimuth: 0.0,
33            converged: false,
34            reduced_length: 0.0,
35            geodesic_scale: 1.0,
36        }
37    }
38}