List of utility methods to do Double Number Clamp
double | clamp(double weight, double lowerBound, double upperBound) clamp if (weight > upperBound) { weight = upperBound; } else if (weight < lowerBound) { weight = lowerBound; return weight; |
double | clamp(double x, double low, double high) Restrict x to the range [low, high]. return x < low ? low : (x > high ? high : x);
|
double | clamp(double x, double min, double max) clamp function. return (x < min ? min : (x > max ? max : x));
|
double | clamp(double x, double min, double max) Returns x if it is within the specified range, or the closest value within the specified range if x is outside the range. if (x < min) { return min; } else if (x > max) { return max; } else { return x; |
double | clamp(double x, double xMin, double xMax) If x is between xMin and xMax, then return x; if x is less than xMin, then return xMin; if x is greater than xMax, then return xMax. return (x < xMin) ? xMin : ((x > xMax) ? xMax : x);
|
double | clamp(final double value, final double min, final double max) clamp if (min > max) { throw new IllegalArgumentException("min > max"); if (value < min) { return min; } else if (value > max) { return max; } else { ... |
double | clamp(final double value, final double min, final double max) clamp return Math.max(min, Math.min(max, value));
|
double | clamp01(double d) clamp if (d < 0) d = 0; else if (d > 1) d = 1; return d; |
double | clamp01(double value) clamp return clamp(value, 0.0, 1.0);
|
int | clamp255d(double d) clampd return clamp255((int) d); |