clamp
Test a value in specified range, returning minimum if it's below, and maximum if it's above
Return
value if it's between min and max, min if it's below, max if it's above
Parameters
value
Value to test
min
Minimum value of range
max
Maximum value of range