[][src]Trait geographiclib_rs::InverseGeodesic

pub trait InverseGeodesic<T> {
    fn inverse(&self, lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> T;
}

Solve the inverse geodesic problem.

Arguments

  • lat1 latitude of point 1 (degrees).
  • lon1 longitude of point 1 (degrees).
  • lat2 latitude of point 2 (degrees).
  • lon2 longitude of point 2 (degrees).

Returns

There are a variety of outputs associated with this calculation. We save computation by only calculating the outputs you need. See the following impls which return different subsets of the following outputs:

  • s12 distance between point 1 and point 2 (meters).
  • azi1 azimuth at point 1 (degrees).
  • azi2 (forward) azimuth at point 2 (degrees).
  • m12 reduced length of geodesic (meters).
  • M12 geodesic scale of point 2 relative to point 1 (dimensionless).
  • M21 geodesic scale of point 1 relative to point 2 (dimensionless).
  • S12 area under the geodesic (meters2).
  • a12 arc length of between point 1 and point 2 (degrees).

\e lat1 and \e lat2 should be in the range [−90°, 90°]. The values of \e azi1 and \e azi2 returned are in the range [−180°, 180°].

If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing \e lat = ±(90° − ε), and taking the limit ε → 0+.

The solution to the inverse problem is found using Newton's method. If this fails to converge (this is very unlikely in geodetic applications but does occur for very eccentric ellipsoids), then the bisection method is used to refine the solution.

// Example, determine the distance between two points
use geographiclib_rs::{Geodesic, InverseGeodesic};

let g = Geodesic::wgs84();
let p1 = (34.095925, -118.2884237);
let p2 = (59.4323439, 24.7341649);
let s12: f64 = g.inverse(p1.0, p1.1, p2.0, p2.1);

use assert_approx_eq::assert_approx_eq;
assert_approx_eq!(s12, 9094718.72751138);

Required methods

fn inverse(&self, lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> T

Loading content...

Implementors

impl InverseGeodesic<f64> for Geodesic[src]

fn inverse(&self, lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> f64[src]

See the documentation for the InverseGeodesic trait.

Returns

  • s12 distance between point 1 and point 2 (meters).

impl InverseGeodesic<(f64, f64)> for Geodesic[src]

fn inverse(&self, lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> (f64, f64)[src]

See the documentation for the InverseGeodesic trait.

Returns

  • s12 distance between point 1 and point 2 (meters).
  • a12 arc length of between point 1 and point 2 (degrees).

impl InverseGeodesic<(f64, f64, f64)> for Geodesic[src]

fn inverse(&self, lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> (f64, f64, f64)[src]

See the documentation for the InverseGeodesic trait.

Returns

  • azi1 azimuth at point 1 (degrees).
  • azi2 (forward) azimuth at point 2 (degrees).
  • a12 arc length of between point 1 and point 2 (degrees).

impl InverseGeodesic<(f64, f64, f64, f64)> for Geodesic[src]

fn inverse(
    &self,
    lat1: f64,
    lon1: f64,
    lat2: f64,
    lon2: f64
) -> (f64, f64, f64, f64)
[src]

See the documentation for the InverseGeodesic trait.

Returns

  • s12 distance between point 1 and point 2 (meters).
  • azi1 azimuth at point 1 (degrees).
  • azi2 (forward) azimuth at point 2 (degrees).
  • a12 arc length of between point 1 and point 2 (degrees).

impl InverseGeodesic<(f64, f64, f64, f64, f64)> for Geodesic[src]

fn inverse(
    &self,
    lat1: f64,
    lon1: f64,
    lat2: f64,
    lon2: f64
) -> (f64, f64, f64, f64, f64)
[src]

See the documentation for the InverseGeodesic trait.

Returns

  • s12 distance between point 1 and point 2 (meters).
  • azi1 azimuth at point 1 (degrees).
  • azi2 (forward) azimuth at point 2 (degrees).
  • m12 reduced length of geodesic (meters).
  • a12 arc length of between point 1 and point 2 (degrees).

impl InverseGeodesic<(f64, f64, f64, f64, f64, f64)> for Geodesic[src]

fn inverse(
    &self,
    lat1: f64,
    lon1: f64,
    lat2: f64,
    lon2: f64
) -> (f64, f64, f64, f64, f64, f64)
[src]

See the documentation for the InverseGeodesic trait.

Returns

  • s12 distance between point 1 and point 2 (meters).
  • azi1 azimuth at point 1 (degrees).
  • azi2 (forward) azimuth at point 2 (degrees).
  • M12 geodesic scale of point 2 relative to point 1 (dimensionless).
  • M21 geodesic scale of point 1 relative to point 2 (dimensionless).
  • a12 arc length of between point 1 and point 2 (degrees).

impl InverseGeodesic<(f64, f64, f64, f64, f64, f64, f64)> for Geodesic[src]

fn inverse(
    &self,
    lat1: f64,
    lon1: f64,
    lat2: f64,
    lon2: f64
) -> (f64, f64, f64, f64, f64, f64, f64)
[src]

See the documentation for the InverseGeodesic trait.

Returns

  • s12 distance between point 1 and point 2 (meters).
  • azi1 azimuth at point 1 (degrees).
  • azi2 (forward) azimuth at point 2 (degrees).
  • m12 reduced length of geodesic (meters).
  • M12 geodesic scale of point 2 relative to point 1 (dimensionless).
  • M21 geodesic scale of point 1 relative to point 2 (dimensionless).
  • a12 arc length of between point 1 and point 2 (degrees).

impl InverseGeodesic<(f64, f64, f64, f64, f64, f64, f64, f64)> for Geodesic[src]

fn inverse(
    &self,
    lat1: f64,
    lon1: f64,
    lat2: f64,
    lon2: f64
) -> (f64, f64, f64, f64, f64, f64, f64, f64)
[src]

See the documentation for the InverseGeodesic trait.

Returns

  • s12 distance between point 1 and point 2 (meters).
  • azi1 azimuth at point 1 (degrees).
  • azi2 (forward) azimuth at point 2 (degrees).
  • m12 reduced length of geodesic (meters).
  • M12 geodesic scale of point 2 relative to point 1 (dimensionless).
  • M21 geodesic scale of point 1 relative to point 2 (dimensionless).
  • S12 area under the geodesic (meters2).
  • a12 arc length of between point 1 and point 2 (degrees).
Loading content...