pub struct Orthodrome {
pub lon1: f64,
pub lat1: f64,
pub lon2: f64,
pub lat2: f64,
pub a: f64,
pub dist: f64,
}Expand description
§Orthodrome
§Description
Represents an orthodrome, which is the shortest path between two points on a sphere.
§Usage
The methods you have access to:
Orthodrome::new: Create a new OrthodromeOrthodrome::from_points: Create an orthodrome from two points. The points must implement theGetXYtraitOrthodrome::intermediate_point: input t 0->1. Find a point along the orthodrome.Orthodrome::bearing: returns the bearing in degrees between the two pointsOrthodrome::distance_to: Finds the distance between the two points in kilometers projected normalized (0->1)
The properties you have access to:
Orthodrome::lon1: start longitude in radiansOrthodrome::lat1: start latitude in radiansOrthodrome::lon2: end longitude in radiansOrthodrome::lat2: end latitude in radiansOrthodrome::a: distance propertyOrthodrome::dist: distance property
use gistools::{geometry::LonLat, tools::Orthodrome};
let ortho = Orthodrome::new(-60., -40., 20., 10.);
assert_eq!(ortho.intermediate_point::<LonLat>(0.), LonLat::new(-59.99999999999999, -40., None));
assert_eq!(
ortho.intermediate_point::<LonLat>(0.2),
LonLat::new(-39.13793657428956, -33.728521975616516, None)
);§NOTE
There is no reason to use this outside verbosity. You can create an S1Angle or use the utility functions in LonLat
§Links
Fields§
§lon1: f64start longitude in radians
lat1: f64start latitude in radians
lon2: f64end longitude in radians
lat2: f64end latitude in radians
a: f64distance property
dist: f64distance property
Implementations§
Source§impl Orthodrome
impl Orthodrome
Sourcepub fn new(
start_lon: f64,
start_lat: f64,
end_lon: f64,
end_lat: f64,
) -> Orthodrome
pub fn new( start_lon: f64, start_lat: f64, end_lon: f64, end_lat: f64, ) -> Orthodrome
Create an orthodrome
Sourcepub fn from_points<P1: GetXY, P2: GetXY>(p1: &P1, p2: &P2) -> Orthodrome
pub fn from_points<P1: GetXY, P2: GetXY>(p1: &P1, p2: &P2) -> Orthodrome
Create an orthodrome from two points
The points must implement the GetXY trait
Sourcepub fn intermediate_point<P: NewXY>(&self, t: f64) -> P
pub fn intermediate_point<P: NewXY>(&self, t: f64) -> P
Sourcepub fn distance_to(&self) -> f64
pub fn distance_to(&self) -> f64
Finds the distance between the two points in kilometers projected normalized (0->1)
§Returns
The total distance between the two points
Trait Implementations§
Source§impl Clone for Orthodrome
impl Clone for Orthodrome
Source§fn clone(&self) -> Orthodrome
fn clone(&self) -> Orthodrome
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Orthodrome
impl Debug for Orthodrome
Source§impl Default for Orthodrome
impl Default for Orthodrome
Source§fn default() -> Orthodrome
fn default() -> Orthodrome
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Orthodrome
impl RefUnwindSafe for Orthodrome
impl Send for Orthodrome
impl Sync for Orthodrome
impl Unpin for Orthodrome
impl UnwindSafe for Orthodrome
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().