Name[]
clamp - returns smallest integer not less than a scalar or each vector component.
Synopsis[]
vector1 clamp(vector1 x, vector a, vector b); vector2 clamp(vector2 x, vector a, vector b); vector3 clamp(vector3 x, vector a, vector b); vector4 clamp(vector4 x, vector a, vector b);
Parameters[]
- x
- Vector or scalar to clamp.
- a
- Vector or scalar for bottom of clamp range.
- b
- Vector or scalar for top of clamp range.
Description[]
Returns x clamped to the range [a,b] as follows:
- 1) Returns a if x is less than a; else
- 2) Returns b if x is greater than b; else
- 3) Returns x otherwise.
For vectors, the returned vector contains the clamped result of each element of the vector x clamped using the respective element of vectors a and b.