Java Utililty Methods Float Number Clamp

List of utility methods to do Float Number Clamp

Description

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

Method

floatclamp(final float min, final float x, final float max)
Clamps the input x between min and max
return Math.max(min, Math.min(x, max));
floatclamp(final float num, final float bound1, final float bound2)
clamp
final float max = Math.max(bound1, bound2), min = Math.min(bound1, bound2);
return Math.max(Math.min(num, max), min);
floatclamp(final float v, final float min, final float max)
clamp
if (v < min)
    return min;
else if (v > max)
    return max;
else
    return v;
floatclamp(final float val, final float min, final float max)
With this function you can maintain an input value between a specified range.
return Math.max(min, Math.min(max, val));
floatclamp(final float value, final float min, final float max)
Constrains a value between a min and a max
return (value < min) ? min : ((value > max) ? max : value);
floatclamp(final float x, final float a, final float b)
clamp
return x < a ? a : x > b ? b : x;
floatClamp(float a, float min, float max)
Clamp
if (a < min) {
    return min;
} else if (a > max) {
    return max;
} else {
    return a;
floatclamp(float a, float min, float max)
clamp
return a < min ? min : (a > max ? max : a);
floatclamp(float f)
Clamp the given value to [0, 1]
f = f < 0.0f ? 0.0f : f;
f = f > 1.0f ? 1.0f : f;
return f;
floatclamp(float f, float min, float max)
Rounds the given value so that it's bigger or equal to min and smaller or equal to max.
float r = f;
if (r < min)
    r = min;
if (r > max)
    r = max;
return r;