Here you can find the source of clampZero_float(float value, float max)
Parameter | Description |
---|---|
value | = the number to clamp |
max | = maximum possible value |
public static float clampZero_float(float value, float max)
//package com.java2s; //License from project: Open Source License public class Main { /**// w ww .j a v a 2 s . co m * @param value = the number to clamp * @param max = maximum possible value * @return a float clamped between 0 and max */ public static float clampZero_float(float value, float max) { return clampFloat(value, 0f, max); } /** * @param value = the number to clamp * @param max = maximum possible value * @param min = minimum possible value */ public static float clampFloat(float value, float min, float max) { return (value < min) ? min : (value > max) ? max : value; } }