pub fn clamp01(x: f32) -> f32Expand description
Clamps (limits) the value of x in the inclusive range from 0.0 to 1.0.
If x < 0.0, 0.0 is returned. If x > 1.0, 1.0 is returned.
ยงExamples
assert_eq!(clamp01(-10.0), 0.0);
assert_eq!(clamp01(0.12345678), 0.12345678);
assert_eq!(clamp01(999.8989), 1.0);