CLAMP
A value kept within limits.
Syntax
CLAMP(x,low,high)
| Argument | Meaning |
|---|---|
| x | A number, or a position. |
| low, high | The limits (for a position, the corners of a box). |
Result
x, or the limit it goes past.
Examples
In the example drawing:
| Expression | Gives |
|---|---|
CLAMP(15,0,10) |
10 |
CLAMP(-2,0,10) |
0 |
CLAMP([15,5],[0,0],[10,10]) |
[10,5] |
CLAMP(1/8,1/4,1/2) |
1/4 |
Notes
It is an error if low is more than high.