Java Utililty Methods Float Number Clip

List of utility methods to do Float Number Clip

Description

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

Method

floatclip(float f, float lo, float hi)
clip
if (f < lo)
    return lo;
if (f > hi)
    return hi;
return f;
floatclip(float value, float bottom, float top)
clip
return (value < bottom) ? bottom : (value > top) ? top : value;
floatclip(float x)
Simple utility function that is used in a couple of places.
return Math.min(Math.max(x, 0), 1);
floatclipf(float num, float mini, float maxi)
clipf
if (num >= mini && num <= maxi)
    return num;
return (num < mini) ? mini : maxi;
floatclipFloat(float value, float min, float max)
clip Float
if (value > max)
    value = max;
if (value < min)
    value = min;
return value;
floatclipNormalized(final float a)
Clips the value to the 0.0 ..
if (a < 0) {
    return 0;
} else if (a > 1) {
    return 1;
return a;
voidclipToRange(float[][] in, float min, float max)
clip To Range
int width = in[0].length;
int height = in.length;
for (int yy = 0; yy < height; yy++) {
    for (int xx = 0; xx < width; xx++) {
        if (in[yy][xx] > max) {
            in[yy][xx] = max;
        if (in[yy][xx] < min) {
...