Struct nalgebra::core::Unit[][src]

#[repr(C)]
pub struct Unit<T> { /* fields omitted */ }

A wrapper that ensures the undelying algebraic entity has a unit norm.

Use .as_ref() or .unwrap() to obtain the undelying value by-reference or by-move.

Methods

impl<T: NormedSpace> Unit<T>
[src]

Normalize the given value and return it wrapped on a Unit structure.

Attempts to normalize the given value and return it wrapped on a Unit structure.

Returns None if the norm was smaller or equal to min_norm.

Normalize the given value and return it wrapped on a Unit structure and its norm.

Normalize the given value and return it wrapped on a Unit structure and its norm.

Returns None if the norm was smaller or equal to min_norm.

Normalizes this value again. This is useful when repeated computations might cause a drift in the norm because of float inaccuracies.

Returns the norm before re-normalization (should be close to 1.0).

impl<T> Unit<T>
[src]

Wraps the given value, assuming it is already normalized.

This function is not safe because value is not verified to be actually normalized.

Retrieves the underlying value.

Important traits for &'a mut R

Returns a mutable reference to the underlying value. This is _unchecked because modifying the underlying value in such a way that it no longer has unit length may lead to unexpected results.

Trait Implementations

impl<N, R: Dim, C: Dim, S> ApproxEq for Unit<Matrix<N, R, C, S>> where
    N: Scalar + ApproxEq,
    S: Storage<N, R, C>,
    N::Epsilon: Copy
[src]

Used for specifying relative comparisons.

The default tolerance to use when testing values that are close together. Read more

The default relative tolerance for testing values that are far-apart. Read more

The default ULPs to tolerate when testing values that are far-apart. Read more

A test for equality that uses a relative comparison if the values are far apart.

A test for equality that uses units in the last place (ULP) if the values are far apart.

The inverse of ApproxEq::relative_eq.

The inverse of ApproxEq::ulps_eq.

impl<T: Eq> Eq for Unit<T>
[src]

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

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

This method tests for !=.

impl<T: Clone> Clone for Unit<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Hash> Hash for Unit<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: Debug> Debug for Unit<T>
[src]

Formats the value using the given formatter. Read more

impl<T: Copy> Copy for Unit<T>
[src]

impl<T> AsRef<T> for Unit<T>
[src]

Important traits for &'a mut R

Performs the conversion.

impl<T: NormedSpace> SubsetOf<T> for Unit<T> where
    T::Field: ApproxEq
[src]

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

impl<T: Neg> Neg for Unit<T>
[src]

The resulting type after applying the - operator.

Performs the unary - operation.

impl<T> Deref for Unit<T>
[src]

The resulting type after dereferencing.

Important traits for &'a mut R

Dereferences the value.

impl<'a, 'b, N: Real, SB: Storage<N, U3>> Mul<&'b Unit<Vector<N, U3, SB>>> for &'a UnitQuaternion<N> where
    DefaultAllocator: Allocator<N, U4, U1> + Allocator<N, U3, U1>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a, N: Real, SB: Storage<N, U3>> Mul<Unit<Vector<N, U3, SB>>> for &'a UnitQuaternion<N> where
    DefaultAllocator: Allocator<N, U4, U1> + Allocator<N, U3, U1>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'b, N: Real, SB: Storage<N, U3>> Mul<&'b Unit<Vector<N, U3, SB>>> for UnitQuaternion<N> where
    DefaultAllocator: Allocator<N, U4, U1> + Allocator<N, U3, U1>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<N: Real, SB: Storage<N, U3>> Mul<Unit<Vector<N, U3, SB>>> for UnitQuaternion<N> where
    DefaultAllocator: Allocator<N, U4, U1> + Allocator<N, U3, U1>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<N: Real, S: Storage<N, U2>> Mul<Unit<Vector<N, U2, S>>> for UnitComplex<N> where
    DefaultAllocator: Allocator<N, U2, U1>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a, N: Real, S: Storage<N, U2>> Mul<Unit<Vector<N, U2, S>>> for &'a UnitComplex<N> where
    DefaultAllocator: Allocator<N, U2, U1>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'b, N: Real, S: Storage<N, U2>> Mul<&'b Unit<Vector<N, U2, S>>> for UnitComplex<N> where
    DefaultAllocator: Allocator<N, U2, U1>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a, 'b, N: Real, S: Storage<N, U2>> Mul<&'b Unit<Vector<N, U2, S>>> for &'a UnitComplex<N> where
    DefaultAllocator: Allocator<N, U2, U1>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<N: Real, D: DimName, R> Mul<Unit<VectorN<N, D>>> for Isometry<N, D, R> where
    R: AlgaRotation<Point<N, D>>,
    DefaultAllocator: Allocator<N, D>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a, N: Real, D: DimName, R> Mul<Unit<VectorN<N, D>>> for &'a Isometry<N, D, R> where
    R: AlgaRotation<Point<N, D>>,
    DefaultAllocator: Allocator<N, D>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'b, N: Real, D: DimName, R> Mul<&'b Unit<VectorN<N, D>>> for Isometry<N, D, R> where
    R: AlgaRotation<Point<N, D>>,
    DefaultAllocator: Allocator<N, D>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<'a, 'b, N: Real, D: DimName, R> Mul<&'b Unit<VectorN<N, D>>> for &'a Isometry<N, D, R> where
    R: AlgaRotation<Point<N, D>>,
    DefaultAllocator: Allocator<N, D>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

Auto Trait Implementations

impl<T> Send for Unit<T> where
    T: Send

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