nalgebra/src/traits/norm.rs

21 lines
449 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
{
/// Computes the norm a an object.
2013-06-25 05:38:52 +08:00
fn norm(&self) -> N;
2013-05-19 01:04:03 +08:00
/**
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
*/
2013-06-25 05:38:52 +08:00
fn sqnorm(&self) -> N;
2013-05-19 01:04:03 +08:00
/// 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-06-25 05:38:52 +08:00
fn normalize(&mut self) -> N;
2013-05-19 01:04:03 +08:00
}