Struct flat_projection::FlatPoint
[−]
[src]
pub struct FlatPoint<T> { /* fields omitted */ }
Representation of a geographical point on Earth as projected
by a FlatProjection
instance.
let (lon, lat) = (6.186389, 50.823194); let proj = FlatProjection::new(51.); let flat_point = proj.project(lon, lat);
Methods
impl<T: Float> FlatPoint<T>
[src]
pub fn distance(&self, other: &FlatPoint<T>) -> T
[src]
Calculates the approximate distance in kilometers from
this FlatPoint
to another.
let (lon1, lat1) = (6.186389, 50.823194); let (lon2, lat2) = (6.953333, 51.301389); let proj = FlatProjection::new(51.05); let p1 = proj.project(lon1, lat1); let p2 = proj.project(lon2, lat2); let distance = p1.distance(&p2); // -> 75.648 km
pub fn distance_squared(&self, other: &FlatPoint<T>) -> T
[src]
Calculates the approximate squared distance from this FlatPoint
to
another.
This method can be used for fast distance comparisons.
pub fn bearing(&self, other: &FlatPoint<T>) -> T
[src]
Calculates the approximate average bearing in degrees
between -180 and 180 from this FlatPoint
to another.
let (lon1, lat1) = (6.186389, 50.823194); let (lon2, lat2) = (6.953333, 51.301389); let proj = FlatProjection::new(51.05); let p1 = proj.project(lon1, lat1); let p2 = proj.project(lon2, lat2); let bearing = p1.bearing(&p2); // -> 45.3°
pub fn distance_bearing(&self, other: &FlatPoint<T>) -> (T, T)
[src]
Calculates the approximate distance
and average bearing
from this FlatPoint
to another.
let (lon1, lat1) = (6.186389, 50.823194); let (lon2, lat2) = (6.953333, 51.301389); let proj = FlatProjection::new(51.05); let p1 = proj.project(lon1, lat1); let p2 = proj.project(lon2, lat2); let (distance, bearing) = p1.distance_bearing(&p2); // -> 75.648 km and 45.3°
pub fn destination(&self, dist: T, bearing: T) -> FlatPoint<T>
[src]
Returns a new FlatPoint
given distance
and bearing
from this FlatPoint
.
let (lon, lat) = (30.5, 50.5); let proj = FlatProjection::new(50.); let p1 = proj.project(lon, lat); let (distance, bearing) = (1., 45.0); let p2 = p1.destination(distance, bearing);
pub fn offset(&self, dx: T, dy: T) -> FlatPoint<T>
[src]
Returns a new FlatPoint
given easting and northing offsets
(in kilometers) from this FlatPoint
.
let (lon, lat) = (30.5, 50.5); let proj = FlatProjection::new(50.); let p1 = proj.project(lon, lat); let p2 = p1.offset(10., 10.);
Trait Implementations
impl<T: Debug> Debug for FlatPoint<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: Copy> Copy for FlatPoint<T>
[src]
impl<T: Clone> Clone for FlatPoint<T>
[src]
fn clone(&self) -> FlatPoint<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq for FlatPoint<T>
[src]
fn eq(&self, __arg_0: &FlatPoint<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &FlatPoint<T>) -> bool
[src]
This method tests for !=
.
impl<T: PartialOrd> PartialOrd for FlatPoint<T>
[src]
fn partial_cmp(&self, __arg_0: &FlatPoint<T>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &FlatPoint<T>) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &FlatPoint<T>) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &FlatPoint<T>) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &FlatPoint<T>) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more