pub trait CoordinateTuple {
Show 30 methods // Required methods fn nth_unchecked(&self, n: usize) -> f64; fn set_nth_unchecked(&mut self, n: usize, value: f64); fn dim(&self) -> usize; // Provided methods fn nth(&self, n: usize) -> f64 { ... } fn x(&self) -> f64 { ... } fn y(&self) -> f64 { ... } fn z(&self) -> f64 { ... } fn t(&self) -> f64 { ... } fn xy(&self) -> (f64, f64) { ... } fn xyz(&self) -> (f64, f64, f64) { ... } fn xyzt(&self) -> (f64, f64, f64, f64) { ... } fn xy_to_degrees(&self) -> (f64, f64) { ... } fn xyz_to_degrees(&self) -> (f64, f64, f64) { ... } fn xyzt_to_degrees(&self) -> (f64, f64, f64, f64) { ... } fn xy_to_arcsec(&self) -> (f64, f64) { ... } fn xyz_to_arcsec(&self) -> (f64, f64, f64) { ... } fn xyzt_to_arcsec(&self) -> (f64, f64, f64, f64) { ... } fn xy_to_radians(&self) -> (f64, f64) { ... } fn xyz_to_radians(&self) -> (f64, f64, f64) { ... } fn xyzt_to_radians(&self) -> (f64, f64, f64, f64) { ... } fn fill(&mut self, value: f64) { ... } fn set_nth(&mut self, n: usize, value: f64) { ... } fn set_xy(&mut self, x: f64, y: f64) { ... } fn set_xyz(&mut self, x: f64, y: f64, z: f64) { ... } fn set_xyzt(&mut self, x: f64, y: f64, z: f64, t: f64) { ... } fn update(&mut self, value: &[f64]) { ... } fn hypot2(&self, other: &Self) -> f64 where Self: Sized { ... } fn hypot3(&self, other: &Self) -> f64 where Self: Sized { ... } fn scale(&self, factor: f64) -> Self where Self: Sized + Copy { ... } fn dot(&self, other: Self) -> f64 where Self: Sized { ... }
}
Expand description

CoordinateTuple is the ISO-19111 atomic spatial/spatiotemporal referencing element. So loosely speaking, a CoordinateSet is a collection of CoordinateTuples.

Note that (despite the formal name) the underlying data structure need not be a tuple: It can be any item, for which it makes sense to implement the CoordinateTuple trait.

The CoordinateTuple trait provides a number of convenience accessors for accessing single coordinate elements or tuples of subsets. These accessors are pragmatically named (x, y, xy, etc.). While these names may be geodetically naïve, they are suggestive, practical, and aligns well with the internal coordinate order convention of most Geodesy operators.

All accessors have default implementations, except the 3 methods nth_unchecked(), set_nth_unchecked() and dim(), which must be provided by the implementer.

When accessing dimensions outside of the domain of the CoordinateTuple, NaN will be returned.

Required Methods§

source

fn nth_unchecked(&self, n: usize) -> f64

Access the n’th (0-based) element of the CoordinateTuple. May panic if n >= DIMENSION. See also nth().

source

fn set_nth_unchecked(&mut self, n: usize, value: f64)

Replace the n’th (0-based) element of the CoordinateTuple with value. May panic if n >= dim(). See also set_nth().

source

fn dim(&self) -> usize

Native dimension of the coordinate tuple

Provided Methods§

source

fn nth(&self, n: usize) -> f64

Access the n’th (0-based) element of the CoordinateTuple. Returns NaN if n >= DIMENSION. See also nth().

source

fn x(&self) -> f64

Pragmatically named accessor for the first element of the CoordinateTuple.

source

fn y(&self) -> f64

Pragmatically named accessor for the second element of the CoordinateTuple.

source

fn z(&self) -> f64

Pragmatically named accessor for the third element of the CoordinateTuple.

source

fn t(&self) -> f64

Pragmatically named accessor for the fourth element of the CoordinateTuple.

source

fn xy(&self) -> (f64, f64)

A tuple containing the first two components of the CoordinateTuple.

source

fn xyz(&self) -> (f64, f64, f64)

A tuple containing the first three components of the CoordinateTuple.

source

fn xyzt(&self) -> (f64, f64, f64, f64)

A tuple containing the first four components of the CoordinateTuple.

source

fn xy_to_degrees(&self) -> (f64, f64)

A tuple containing the first two components of the CoordinateTuple converted from radians to degrees

source

fn xyz_to_degrees(&self) -> (f64, f64, f64)

A tuple containing the first three components of the CoordinateTuple, with the first two converted from radians to degrees.

source

fn xyzt_to_degrees(&self) -> (f64, f64, f64, f64)

A tuple containing the first four components of the CoordinateTuple, with the first two converted from radians to degrees.

source

fn xy_to_arcsec(&self) -> (f64, f64)

A tuple containing the first two components of the CoordinateTuple, converted from radians to seconds-of-arc

source

fn xyz_to_arcsec(&self) -> (f64, f64, f64)

A tuple containing the first three components of the CoordinateTuple, with the first two converted to seconds-of-arc

source

fn xyzt_to_arcsec(&self) -> (f64, f64, f64, f64)

A tuple containing the first four components of the CoordinateTuple, with the first two converted to seconds-of-arc

source

fn xy_to_radians(&self) -> (f64, f64)

A tuple containing the first two components of the CoordinateTuple, converted from degrees to radians

source

fn xyz_to_radians(&self) -> (f64, f64, f64)

A tuple containing the first three components of the CoordinateTuple, with the first two converted from degrees to radians

source

fn xyzt_to_radians(&self) -> (f64, f64, f64, f64)

A tuple containing the first four components of the CoordinateTuple, with the first two converted from degrees to radians

source

fn fill(&mut self, value: f64)

Fill all elements of self with value

source

fn set_nth(&mut self, n: usize, value: f64)

Replace the n’th (0-based) element of the CoordinateTuple with value. If n >= dim() fill the coordinate with f64::NAN. See also set_nth_unchecked().

source

fn set_xy(&mut self, x: f64, y: f64)

Replace the two first elements of the CoordinateTuple with x and y. If the dimension is less than 2, fill the coordinate with f64::NAN. See also set_nth_unchecked().

source

fn set_xyz(&mut self, x: f64, y: f64, z: f64)

Replace the three first elements of the CoordinateTuple with x, y and z. If the dimension is less than 3, fill the coordinate with f64::NAN.

source

fn set_xyzt(&mut self, x: f64, y: f64, z: f64, t: f64)

Replace the four first elements of the CoordinateTuple with x, y z and t. If the dimension is less than 4, fill the coordinate with f64::NAN.

source

fn update(&mut self, value: &[f64])

Replace the N first (up to dim()) elements of self with the elements of value

source

fn hypot2(&self, other: &Self) -> f64
where Self: Sized,

Euclidean distance between two points in the 2D plane.

Primarily used to compute the distance between two projected points in their projected plane. Typically, this distance will differ from the actual distance in the real world.

§See also:

hypot3, distance

§Examples
use geodesy::prelude::*;
let t = 1000 as f64;
let p0 = Coor2D::origin();
let p1 = Coor2D::raw(t, t);
assert_eq!(p0.hypot2(&p1), t.hypot(t));
source

fn hypot3(&self, other: &Self) -> f64
where Self: Sized,

Euclidean distance between two points in the 3D space.

Primarily used to compute the distance between two points in the 3D cartesian space. The typical case is GNSS-observations, in which case, the distance computed will reflect the actual distance in the real world.

The distance is computed in the subspace spanned by the first, second and third coordinate of the Coor3Ds

§See also:

hypot2(), distance

§Examples
use geodesy::prelude::*;
let t = 1000 as f64;
let p0 = Coor3D::origin();
let p1 = Coor3D::raw(t, t, t);
assert_eq!(p0.hypot3(&p1), t.hypot(t).hypot(t));
source

fn scale(&self, factor: f64) -> Self
where Self: Sized + Copy,

source

fn dot(&self, other: Self) -> f64
where Self: Sized,

Implementations on Foreign Types§

source§

impl CoordinateTuple for (f64, f64)

source§

fn dim(&self) -> usize

source§

fn nth_unchecked(&self, n: usize) -> f64

source§

fn set_nth_unchecked(&mut self, n: usize, value: f64)

Implementors§