List of utility methods to do Float Number Clamp
float | clampAngle(float value, float min, float max) Replies the value clamped in the specified interval assuming the it is a angle in radians. assert (min <= max); float v = value; while (v > max) { v -= 2 * Math.PI; if (v < min) return min; return v; ... |
float | clampAngle(float var, float min, float max) Clamps the angles to a min max by adding or subtracting the min max. while (var < min) { var += 360; while (var > max) { var -= 360; return var; |
float[] | clampBounds(float[] target, float[] clamp) Clamps the target bounds using the provided `clamp` bounds assert target.length == 6; if (target[0] < clamp[0]) target[0] = clamp[0]; if (target[1] < clamp[1]) target[1] = clamp[1]; if (target[2] < clamp[2]) target[2] = clamp[2]; if (target[3] > clamp[3]) ... |
float | clampColour(float value) clamp Colour return clampFloat(value, 0.0f, 1.0f);
|
float | clampDegree0To360(float degree) Replies the specified angle translated between 0 and 360. if ((!Float.isNaN(degree)) && (!Float.isInfinite(degree))) { return clampTrigo(degree, 0, 360); return degree; |
float | clampFloat(float value, float minimum, float maximum) clamp Float return Math.max(minimum, Math.max(maximum, value));
|
float | clampLevel(float level) clamp Level if (level <= 0.1f) return 0.1f; if (level >= 0.9f) return 1.0f; return level; |
float | clampLevel(float level) clamp Level if (level <= LOWER_CLAMP_LIMIT) return LOWER_CLAMP_VALUE; if (level >= UPPER_CLAMP_LIMIT) return UPPER_CLAMP_VALUE; return level; |
float | clampNumberFromTime(long ms, float seconds) clamp Number From Time float f = getNumberFromTime(ms, seconds); if (f >= 0.5f) { return 1f - f; } else return f; |
float | clampPercentage(float value) Clamps between 0 and 1, use full for percentages. return clamp(value, 0f, 1f);
|