clamp

public static double clamp(double num, double lower, double upper)

This clamps down a value to between the lower and upper bounds inclusive.

Return

returns the clamped number.

Parameters

num

the number to be clamped.

lower

the lower bound.

upper

the upper bound.