Trait gfxmath_vec2::ops::Norm[][src]

pub trait Norm {
    type Output;
    fn norm(self) -> Self::Output;
}

Normalize a vector

Associated Types

Loading content...

Required methods

fn norm(self) -> Self::Output[src]

Loading content...

Implementors

impl Norm for &Vec2<f32>[src]

type Output = Option<Vec2<f32>>

impl Norm for &Vec2<f64>[src]

type Output = Option<Vec2<f64>>

impl Norm for Vec2<f32>[src]

type Output = Option<Vec2<f32>>

fn norm(self) -> Self::Output[src]

use gfxmath_vec2::ops::Norm;
use gfxmath_vec2::Vec2;
 
let a = Vec2::<f32>::new(3.0, 4.0);
let an = a.norm().unwrap();
 
assert_eq!(3.0/5.0, an.x);
assert_eq!(4.0/5.0, an.y);

impl Norm for Vec2<f64>[src]

type Output = Option<Vec2<f64>>

fn norm(self) -> Self::Output[src]

use gfxmath_vec2::ops::Norm;
use gfxmath_vec2::Vec2;
 
let a = Vec2::<f64>::new(3.0, 4.0);
let an = a.norm().unwrap();
 
assert_eq!(3.0/5.0, an.x);
assert_eq!(4.0/5.0, an.y);
Loading content...