clamp

fun clamp(value: Double, min: Double, max: Double): Double(source)

Constraint a value to lie between two values.

Return

The clamped value such that min <= result <= max.

Parameters

value

The value to clamp.

min

The minimum value.

max

The maximum value.

See also