Math module

saturate

procedure · 2 overloadsSource

Clamps to [0, 1]: float, float64, and each component of a vector. A NaN is returned as it is.

ExampleOpen in playground ↗
assert(saturate(1.5) == 1 && saturate(-0.5) == 0 && saturate(0.25) == 0.25);
assert(saturate(xyz(2, -1, 0.5)) == xyz(1, 0, 0.5));
saturate :: (f: float) -> float

Limits f to 0..1.

Parameters

f: float
the value.

Returns

float
saturate :: (f: float64) -> float64

Limits f to 0..1.

Parameters

f: float64
the value.

Returns

float64

See also