Function glm::builtin::normalize [] [src]

pub fn normalize<S: BaseFloat + GenFloat<S>, T: GenFloatVec<S>>(x: T) -> T

Returns a vector in the same direction as x but with a length of 1.

Example

use glm::{ normalize, dvec2, ApproxEq };

assert!(normalize(dvec2(3., 4.)).is_approx_eq(&dvec2(0.6, 0.8)));