clamp

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

Restricts a value to the range min, max degrees, clamping values outside the range. Values less than min are returned as min, and values greater than max are returned as max. Values within the range are returned unmodified.
The result of this method is undefined if min is greater than max.

Return

the specified values clamped to the range min, max degrees

Parameters

value

the values to clamp

min

the minimum value

max

the maximum value