Function calculate_sphere_bearing

Source
pub fn calculate_sphere_bearing<T>(point_a: Point2<T>, point_b: Point2<T>) -> T
where T: Scalar + Float + RealField,
Expand description

Calculates the initial bearing (forward azimuth) from the first point to the second point.

This function computes the initial bearing, or forward azimuth, between two points on the surface of a sphere, assuming a spherical model. The bearing is the direction one must travel from the first point to reach the second point, expressed as an angle from North (0 radians) in a clockwise direction.

§Arguments

  • point_a: A Point2 representing the starting geographical point (latitude and longitude).
  • point_b: A Point2 representing the destination geographical point (latitude and longitude).

§Generics

T: Either an f32 or f64

§Returns

  • A value that representing the initial bearing from point_a to point_b, in radians, The result is normalized to a range of 0 to 2 PI radians.