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