Function vec3::clamp [−][src]
pub fn clamp<'out, T>(
out: &'out mut [T; 3],
a: &[T; 3],
b: &[T; 3]
) -> &'out mut [T; 3] where
T: Clone + PartialOrd,
Example
let mut v = [0.5_f32; 3]; vec3::clamp(&mut v, &vec3::new_zero(), &vec3::new_one()); assert_eq!(v, [0.5_f32; 3]); let mut v = [-0.5_f32; 3]; vec3::clamp(&mut v, &vec3::new_zero(), &vec3::new_one()); assert_eq!(v, vec3::new_zero()); let mut v = [1.5_f32; 3]; vec3::clamp(&mut v, &vec3::new_zero(), &vec3::new_one()); assert_eq!(v, vec3::new_one());