Trait gfxmath_vec3::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 &Vec3<f32>[src]

type Output = Option<Vec3<f32>>

impl Norm for &Vec3<f64>[src]

type Output = Option<Vec3<f64>>

impl Norm for Vec3<f32>[src]

type Output = Option<Vec3<f32>>

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

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

impl Norm for Vec3<f64>[src]

type Output = Option<Vec3<f64>>

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

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