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]

[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

[src]

Calculates the approximate squared distance from this FlatPoint to another.

This method can be used for fast distance comparisons.

[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°

[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°

[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);

[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]

[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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: PartialEq> PartialEq for FlatPoint<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<T: PartialOrd> PartialOrd for FlatPoint<T>
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[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 FlatPoint<T> where
    T: Send

impl<T> Sync for FlatPoint<T> where
    T: Sync