nalgebra/src/traits/norm.rs

21 lines
460 B
Rust
Raw Normal View History

/**
* Trait of objects having a L² norm and which can be normalized.
*/
2013-05-19 01:04:03 +08:00
pub trait Norm<T>
{
/// Computes the norm a an object.
fn norm(&self) -> T;
/**
2013-05-22 07:20:09 +08:00
* Computes the squared norm of an object. Usually faster than computing the
* norm itself.
2013-05-19 01:04:03 +08:00
*/
fn sqnorm(&self) -> T;
/// Gets the normalized version of the argument.
2013-05-19 01:04:03 +08:00
fn normalized(&self) -> Self;
/// In-place version of `normalized`.
2013-05-19 01:04:03 +08:00
fn normalize(&mut self) -> T;
}