Go to: Synopsis. Return value. MEL examples.

Synopsis

clamp <float> <float> <float>

clamp is undoable, queryable, and editable.

The first two arguments are min and max values respectively. The third argument is the value which this command clamps to the min-max range. If number is outside the range, the return value is clamped to min or max, otherwise, it is the same as the passed in number.

Return value


float

MEL examples

clamp -6 -4 22;
// Result: -4 //
clamp -6 -4 -22;
// Result: -6 //
clamp 6 42 22;
// Result: 22 //