pub fn remap_clamp(
x: f32,
from: RangeInclusive<f32>,
to: RangeInclusive<f32>,
) -> f32
Expand description
Remap a value from one range to another, clamps the input value to be in the from range first.
§Example
let ocean_height = remap_clamp(0.2, -1.0..=1.0, 2.0..=3.1);
§From range requirement
The range has to be from a low value to a high value, such as 0..=1.0, NOT 1.0..=0.0. If it is outside of that range the results will be undefined