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]

[src]

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

[src]

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.

[src]

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

[src]

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.

[src]

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]

[src]

Wraps the given value, assuming it is already normalized.

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

[src]

Retrieves the underlying value.

[src]

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.

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

The inverse of ApproxEq::relative_eq.

[src]

The inverse of ApproxEq::ulps_eq.

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

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

[src]

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

[src]

This method tests for !=.

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

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

1.3.0
[src]

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

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

[src]

Formats the value using the given formatter.

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

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

[src]

Performs the conversion.

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

[src]

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

[src]

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

[src]

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

[src]

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.

[src]

Performs the unary - operation.

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

The resulting type after dereferencing.

[src]

Dereferences the value.