[−][src]Enum mercator_db::space::Position
Store a position as efficiently as possible in terms of space.
Variants
Position1(Coordinate)1 dimension positions.
Position2([Coordinate; 2])2 dimensions positions.
Position3([Coordinate; 3])3 dimensions positions.
Position4([Coordinate; 4])4 dimensions positions.
Position5([Coordinate; 5])5 dimensions positions.
Position6([Coordinate; 6])6 dimensions positions.
Position7([Coordinate; 7])7 dimensions positions.
Position8([Coordinate; 8])8 dimensions positions.
PositionN(Vec<Coordinate>)N dimensions positions.
Methods
impl Position[src]
pub fn dimensions(&self) -> usize[src]
Returns the number of dimensions or size of the vector.
pub fn norm(&self) -> f64[src]
Compute ||self||.
pub fn unit(&self) -> Self[src]
Compute the unit vector pointing in the same direction as self.
pub fn dot_product(&self, rhs: &Self) -> f64[src]
Multiplies self with rhs, producing a scalar value.
self • rhs = product
Note: The two vector sizes must be equal, a.k.a the two vectors must have the same number of dimensions.
Parameters
rhs:
The right-hand side vector.
pub fn reduce_precision(&self, scale: u32) -> Self[src]
Remove bits of precision.
Parameters
scale: Number of bits of precision to remove from each coordinates.
Trait Implementations
impl<'_> Add<&'_ Position> for &'_ Position[src]
type Output = Position
The resulting type after applying the + operator.
fn add(self, rhs: Self) -> Self::Output[src]
impl Add<Position> for Position[src]
type Output = Position
The resulting type after applying the + operator.
fn add(self, rhs: Self) -> Self::Output[src]
impl AddAssign<Position> for Position[src]
fn add_assign(&mut self, rhs: Self)[src]
impl Clone for Position[src]
impl Debug for Position[src]
impl<'de> Deserialize<'de> for Position[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl Display for Position[src]
impl Eq for Position[src]
impl<'_> From<&'_ Position> for Vec<f64>[src]
impl<'_> From<&'_ Vec<f64>> for Position[src]
impl<'s> From<&'s Position> for Vec<&'s Coordinate>[src]
impl From<Position> for Vec<f64>[src]
impl From<Vec<Coordinate>> for Position[src]
fn from(coordinates: Vec<Coordinate>) -> Self[src]
impl From<Vec<f64>> for Position[src]
impl From<Vec<u64>> for Position[src]
impl FromIterator<Coordinate> for Position[src]
fn from_iter<I: IntoIterator<Item = Coordinate>>(iter: I) -> Self[src]
impl FromIterator<f64> for Position[src]
fn from_iter<I: IntoIterator<Item = f64>>(iter: I) -> Self[src]
impl Hash for Position[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Index<usize> for Position[src]
type Output = Coordinate
The returned type after indexing.
fn index(&self, k: usize) -> &Self::Output[src]
impl IndexMut<usize> for Position[src]
impl Mul<Position> for Position[src]
type Output = Vec<Position>
The resulting type after applying the * operator.
fn mul(self, rhs: Self) -> Self::Output[src]
impl Mul<f64> for Position[src]
type Output = Position
The resulting type after applying the * operator.
fn mul(self, rhs: f64) -> Self::Output[src]
impl<'_> Mul<f64> for &'_ Position[src]
type Output = Position
The resulting type after applying the * operator.
fn mul(self, rhs: f64) -> Self::Output[src]
impl MulAssign<f64> for Position[src]
fn mul_assign(&mut self, rhs: f64)[src]
impl Ord for Position[src]
fn cmp(&self, other: &Position) -> Ordering[src]
#[must_use]
fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self[src]
impl PartialEq<Position> for Position[src]
impl PartialOrd<Position> for Position[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl Serialize for Position[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructuralEq for Position[src]
impl StructuralPartialEq for Position[src]
impl<'_> Sub<&'_ Position> for &'_ Position[src]
type Output = Position
The resulting type after applying the - operator.
fn sub(self, rhs: Self) -> Self::Output[src]
impl Sub<Position> for Position[src]
type Output = Position
The resulting type after applying the - operator.
fn sub(self, rhs: Self) -> Self::Output[src]
impl SubAssign<Position> for Position[src]
fn sub_assign(&mut self, rhs: Self)[src]
Auto Trait Implementations
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,