nalgebra/src/traits/norm.rs

21 lines
471 B
Rust
Raw Normal View History

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