Trait nalgebra::Norm [] [src]

pub trait Norm: Sized {
    type NormType: BaseFloat;
    fn norm_squared(&self) -> Self::NormType;
    fn normalize(&self) -> Self;
    fn normalize_mut(&mut self) -> Self::NormType;
    fn try_normalize(&self, min_norm: Self::NormType) -> Option<Self>;
    fn try_normalize_mut(&mut self, min_norm: Self::NormType) -> Option<Self::NormType>;

    fn norm(&self) -> Self::NormType { ... }
}

Traits of objects having an euclidian norm.

Associated Types

The scalar type for the norm (i.e. the undelying field).

Required Methods

Computes the squared norm of self.

This is usually faster than computing the norm itself.

Gets the normalized version of a copy of v.

Might return an invalid result if the vector is zero or close to zero.

Normalizes self.

The result might be invalid if the vector is zero or close to zero.

Gets the normalized version of a copy of v or None if the vector has a norm smaller or equal to min_norm. In particular, .try_normalize(0.0) returns None if the norm is exactly zero.

Normalized v or does nothing if the vector has a norm smaller or equal to min_norm.

Returns the old norm or None if the normalization failed.

Provided Methods

Computes the norm of self.

Implementors