clamp static method

double clamp(
  1. double value,
  2. double min,
  3. double max
)

Ensures the given scalar value is within a given min/max range.

Implementation

static double clamp(double value, double min, double max ) {
	return math.max( min, math.min( max, value ) );
}