Struct geoconv::Meters

source ·
pub struct Meters(/* private fields */);
Expand description

Meters represent the SI unit of measure, Meter

Implementations§

source§

impl Meters

source

pub const fn new(meters: f64) -> Meters

Create a new Meters struct, initialized with the provided distance, in meters.

Examples found in repository?
examples/latlon.rs (line 7)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
fn main() {
    let tea_party = LLE::<Wgs84>::new(
        Degrees::new(42.352211),
        Degrees::new(-71.051315),
        Meters::new(0.0),
    );
    let georges_island = LLE::<Wgs84>::new(
        Degrees::new(42.320239),
        Degrees::new(-70.929482),
        Meters::new(100.0),
    );

    let look: AER<Degrees> = tea_party.aer_to(&georges_island);
    println!(
        "Azimuth: {} deg, Elevation: {} deg, Range: {} meters",
        look.azimuth.as_float(),
        look.elevation.as_float(),
        look.range.as_float()
    );
}
More examples
Hide additional examples
examples/converto.rs (line 7)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
fn main() {
    let tea_party = LLE::<Wgs84>::new(
        Degrees::new(42.352211),
        Degrees::new(-71.051315),
        Meters::new(0.0),
    );
    let somewhere =
        LLE::<Wgs72, Radians>::new(Radians::new(0.3), Radians::new(2.2), Meters::new(10.0));

    // Our goal:
    //
    // Take a Wgs84 Lat/Lon in Degrees,and a Wgs72 Lat/Lon in Radians, and
    // compute the look angle in the local tangent plane in Degrees.

    let look: AER<Degrees> = tea_party.aer_to(&somewhere.translate());

    println!(
        "A/E/R: {:?} {:?} {:?}",
        look.azimuth, look.elevation, look.range
    );
}
source

pub const fn as_float(self) -> f64

Return the number of meters as a floating point number. This number may be less than 0 (for distances less than a meter), or very large (for kilometers, etc).

Examples found in repository?
examples/haversine.rs (line 8)
3
4
5
6
7
8
9
fn main() {
    let tea_party = (Degrees::new(42.352211), Degrees::new(-71.051315));
    let georges_island = (Degrees::new(42.320239), Degrees::new(-70.929482));

    let distance = haversine_distance(tea_party, georges_island);
    println!("Distance: {} meters", distance.as_float());
}
More examples
Hide additional examples
examples/latlon.rs (line 20)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
fn main() {
    let tea_party = LLE::<Wgs84>::new(
        Degrees::new(42.352211),
        Degrees::new(-71.051315),
        Meters::new(0.0),
    );
    let georges_island = LLE::<Wgs84>::new(
        Degrees::new(42.320239),
        Degrees::new(-70.929482),
        Meters::new(100.0),
    );

    let look: AER<Degrees> = tea_party.aer_to(&georges_island);
    println!(
        "Azimuth: {} deg, Elevation: {} deg, Range: {} meters",
        look.azimuth.as_float(),
        look.elevation.as_float(),
        look.range.as_float()
    );
}

Trait Implementations§

source§

impl Clone for Meters

source§

fn clone(&self) -> Meters

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Meters

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Meters

source§

fn eq(&self, other: &Meters) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Meters

source§

impl StructuralPartialEq for Meters

Auto Trait Implementations§

§

impl Freeze for Meters

§

impl RefUnwindSafe for Meters

§

impl Send for Meters

§

impl Sync for Meters

§

impl Unpin for Meters

§

impl UnwindSafe for Meters

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.