Function ludomath::num::clamp [] [src]

pub fn clamp(num: f32, a: f32, b: f32) -> f32

Clamps num to the range [a, b].

If num is in the range [a, b], returns num. If num is outside the range, returns the nearest end of the range.

The ends of the range are interchangeable, so that clamp(num, a, b) == clamp(num, b, a)