clamp static method

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

Clamp value between min and max

Implementation

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