Java Utililty Methods Double Number Clamp

List of utility methods to do Double Number Clamp

Description

The list of methods to do Double Number Clamp are organized into topic(s).

Method

doubleclamp(double min, double value, double max)
Simple utility function which clamps the given value to be strictly between the min and max values.
if (value < min)
    return min;
if (value > max)
    return max;
return value;
doubleclamp(double number)
clamp
if (number > 1) {
    number = 1;
if (number < 0) {
    number = 0;
return number;
doubleclamp(double v, double l, double h)
clamps input v to the specified range from l to h
return (v < l) ? l : (v > h) ? h : v;
doubleclamp(double v, double lower, double upper)
Clamp the value v to lower and upper.
return v < lower ? lower : v > upper ? upper : v;
doubleclamp(double v, double lower, double upper)
Clamps a value to the range [lower, upper].
if (v < lower)
    return lower;
else if (v > upper)
    return upper;
else
    return v;
doubleclamp(double val)
clamp
return Math.min(1, Math.max(0, val));
doubleclamp(double val)
Clamps a double between -1 and 1, inclusive.
return clamp(1, val);
doubleclamp(double val, double min, double max)
Clamps the given value using the specified maximum and minimum.
return val < min ? min : val > max ? max : val;
doubleclamp(double val, double min, double max)
clamp
return Math.max(min, Math.min(max, val));
doubleclamp(double value)
Constraint the provided value to lie within [0..1] range.
if (value < 0) {
    value = 0;
if (value > 1) {
    value = 1;
return value;