List of utility methods to do Float Number Clip
float | clip(float f, float lo, float hi) clip if (f < lo) return lo; if (f > hi) return hi; return f; |
float | clip(float value, float bottom, float top) clip return (value < bottom) ? bottom : (value > top) ? top : value;
|
float | clip(float x) Simple utility function that is used in a couple of places. return Math.min(Math.max(x, 0), 1);
|
float | clipf(float num, float mini, float maxi) clipf if (num >= mini && num <= maxi) return num; return (num < mini) ? mini : maxi; |
float | clipFloat(float value, float min, float max) clip Float if (value > max) value = max; if (value < min) value = min; return value; |
float | clipNormalized(final float a) Clips the value to the 0.0 .. if (a < 0) { return 0; } else if (a > 1) { return 1; return a; |
void | clipToRange(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) { ... |