Clamp compares the x and y coordinate values of the current point to alternate values and replaces it with the alternate value if the coordinate is either less than or greater than the alternate value. This function essentially executes the following code:
if (pt1.x < _min)
x = _min;
elseif (pt1.x > _max)
x = _max;
if (pt1.y < _min)
y = _min;
elseif (pt1.y > _max)
y = _max;
Parameters
Parameters
Description
T _min
The alternate value that is compared with the x-coordinate of the point. If the x-coordinate is less than or greater than this value, then the x-coordinate is set to this value.
T _max
The alternate value that is compared with the y-coordinate of the point. If the y-coordinate is less than or greater than this value, then the y-coordinate is set to this value.