Package com.viaversion.viaversion.util
Class MathUtil
java.lang.Object
com.viaversion.viaversion.util.MathUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatMiniscule value below which positive floats are considered zero -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intceil(float value) Returns the ceiled integer value of the given float.static intceilLog2(int i) Returns the ceiled log to the base of 2 for the given number.static longceilLong(double d) static doubleclamp(double d, double min, double max) static intclamp(int i, int min, int max) Returns the clamped number within the given range.
-
Field Details
-
EPSILON
public static final float EPSILONMiniscule value below which positive floats are considered zero- See Also:
-
-
Constructor Details
-
MathUtil
public MathUtil()
-
-
Method Details
-
ceil
public static int ceil(float value) Returns the ceiled integer value of the given float.- Parameters:
value- float value to ceil- Returns:
- ceiled integer value
-
ceilLog2
public static int ceilLog2(int i) Returns the ceiled log to the base of 2 for the given number.- Parameters:
i- positive number to ceillog- Returns:
- ceiled log2 of the given number
-
ceilLong
public static long ceilLong(double d) -
clamp
public static int clamp(int i, int min, int max) Returns the clamped number within the given range.- Parameters:
i- number to clampmin- minimum valuemax- maximum value- Returns:
- clamped number
-
clamp
public static double clamp(double d, double min, double max)
-