pub trait GeodesicBearing<T: CoordNum> {
    // Required methods
    fn geodesic_bearing(&self, point: Point<T>) -> T;
    fn geodesic_bearing_distance(&self, point: Point<T>) -> (T, T);
}
Expand description

Returns the bearing to another Point in degrees on a geodesic.

This uses the geodesic methods given by Karney (2013).

Required Methods§

source

fn geodesic_bearing(&self, point: Point<T>) -> T

Returns the bearing to another Point in degrees, where North is 0° and East is 90°.

§Examples
use geo::GeodesicBearing;
use geo::Point;

let p_1 = Point::new(9.177789688110352, 48.776781529534965);
let p_2 = Point::new(9.27411867078536, 48.8403266058781);
let bearing = p_1.geodesic_bearing(p_2);
assert_relative_eq!(bearing, 45., epsilon = 1.0e-6);
source

fn geodesic_bearing_distance(&self, point: Point<T>) -> (T, T)

Returns the bearing and distance to another Point in a (bearing, distance) tuple.

§Units
  • bearing: degrees, zero degrees is north. East is 90°.
  • distance: meters
§Examples
use geo::GeodesicBearing;
use geo::Point;

let p_1 = Point::new(9.177789688110352, 48.776781529534965);
let p_2 = Point::new(9.27411867078536, 48.8403266058781);
let (bearing, distance) = p_1.geodesic_bearing_distance(p_2);
assert_relative_eq!(bearing, 45., epsilon = 1.0e-6);
assert_relative_eq!(distance, 10000., epsilon = 1.0e-6);

Implementors§