Struct flat_projection::FlatProjection
[−]
[src]
pub struct FlatProjection<T: Float> { /* fields omitted */ }
Projection from WGS84 to a cartesian coordinate system for fast geodesic approximations.
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
Methods
impl<T: Float> FlatProjection<T>
[src]
pub fn new(latitude: T) -> FlatProjection<T>
[src]
Creates a new FlatProjection
instance that will work best around
the given latitude.
let proj = FlatProjection::new(51.);
pub fn project(&self, longitude: T, latitude: T) -> FlatPoint<T>
[src]
Converts a longitude and latitude (in degrees) to a FlatPoint
instance that can be used for fast geodesic approximations.
let (lon, lat) = (6.186389, 50.823194); let proj = FlatProjection::new(51.); let flat_point = proj.project(lon, lat);
pub fn unproject(&self, p: &FlatPoint<T>) -> (T, T)
[src]
Converts a FlatPoint
back to a (lon, lat) tuple.
let (lon, lat) = (6.186389, 50.823194); let proj = FlatProjection::new(51.); let flat_point = proj.project(lon, lat); let result = proj.unproject(&flat_point); assert_eq!(result.0, lon); assert_eq!(result.1, lat);
Trait Implementations
impl<T: Debug + Float> Debug for FlatProjection<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: Copy + Float> Copy for FlatProjection<T>
[src]
impl<T: Clone + Float> Clone for FlatProjection<T>
[src]
fn clone(&self) -> FlatProjection<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 + Float> PartialEq for FlatProjection<T>
[src]
fn eq(&self, __arg_0: &FlatProjection<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: &FlatProjection<T>) -> bool
[src]
This method tests for !=
.
impl<T: PartialOrd + Float> PartialOrd for FlatProjection<T>
[src]
fn partial_cmp(&self, __arg_0: &FlatProjection<T>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &FlatProjection<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: &FlatProjection<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: &FlatProjection<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: &FlatProjection<T>) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
Auto Trait Implementations
impl<T> Send for FlatProjection<T> where
T: Send,
T: Send,
impl<T> Sync for FlatProjection<T> where
T: Sync,
T: Sync,