Struct nav_types::WGS84 [] [src]

pub struct WGS84<N> {
    // some fields omitted
}

Geodetic position

This struct represents a position in the geodetic system on the WGS84 ellipsoid. See: WGS84 for more information.

Methods

impl<N: Float> WGS84<N>
[src]

fn new(latitude: N, longitude: N, altitude: N) -> WGS84<N>

Create a new WGS84 position

Arguments

  • latitude in degrees
  • longitude in degrees
  • altitude in meters

Panics

This will panic if latitude or longitude are not defined on the WGS84 ellipsoid.

fn try_new(latitude: N, longitude: N, altitude: N) -> Option<WGS84<N>>

Try to create a new WGS84 position

Arguments

  • latitude in degrees
  • longitude in degrees
  • altitude in meters

fn latitude_degrees(&self) -> N

Get latitude of position, in degrees

fn longitude_degrees(&self) -> N

Get longitude of position, in degrees

fn distance(&self, other: &WGS84<N>) -> N

Distance between two WGS84 positions

This function uses the haversin formula to calculate the distance between two positions. For more control convert to ECEF and calculate the difference.

Examples

use nav_types::WGS84;

let oslo = WGS84::new(59.95, 10.75, 0.0);
let stockholm = WGS84::new(59.329444, 18.068611, 0.0);

println!("Great circle distance between Oslo and Stockholm: {:?}",
    oslo.distance(&stockholm));

impl<N: Copy> WGS84<N>
[src]

fn altitude(&self) -> N

Get altitude of position

fn latitude(&self) -> N

Get latitude in radians

fn longitude(&self) -> N

Get longitude in radians

Trait Implementations

impl<N: Debug> Debug for WGS84<N>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<N: Copy> Copy for WGS84<N>
[src]

impl<N: Clone> Clone for WGS84<N>
[src]

fn clone(&self) -> WGS84<N>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<N: PartialEq> PartialEq for WGS84<N>
[src]

fn eq(&self, __arg_0: &WGS84<N>) -> bool

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

fn ne(&self, __arg_0: &WGS84<N>) -> bool

This method tests for !=.

impl<N: Float> Add<ENU<N>> for WGS84<N>
[src]

type Output = WGS84<N>

The resulting type after applying the + operator

fn add(self, right: ENU<N>) -> WGS84<N>

The method for the + operator

impl<N: Float> AddAssign<ENU<N>> for WGS84<N>
[src]

fn add_assign(&mut self, right: ENU<N>)

The method for the += operator

impl<N: Float> Sub<ENU<N>> for WGS84<N>
[src]

type Output = WGS84<N>

The resulting type after applying the - operator

fn sub(self, right: ENU<N>) -> WGS84<N>

The method for the - operator

impl<N: Float> Sub<WGS84<N>> for WGS84<N>
[src]

type Output = ENU<N>

The resulting type after applying the - operator

fn sub(self, right: WGS84<N>) -> ENU<N>

The method for the - operator

impl<N: Float> SubAssign<ENU<N>> for WGS84<N>
[src]

fn sub_assign(&mut self, right: ENU<N>)

The method for the -= operator

impl<N: Float> From<NVector<N>> for WGS84<N>
[src]

fn from(f: NVector<N>) -> WGS84<N>

Performs the conversion.

impl<N: Float> From<ECEF<N>> for WGS84<N>
[src]

fn from(f: ECEF<N>) -> WGS84<N>

Performs the conversion.