Package wtf.choco.arrows.util
Class MathUtil
java.lang.Object
wtf.choco.arrows.util.MathUtil
public final class MathUtil extends Object
Miscellaneous math utility methods.
- Author:
 - Parker Hawke - Choco
 
- 
Method Summary
Modifier and Type Method Description static doubleclamp(double value, double min, double max)Clamp a value between a minimum and maximum value.static floatclamp(float value, float min, float max)Clamp a value between a minimum and maximum value.static intclamp(int value, int min, int max)Clamp a value between a minimum and maximum value. 
- 
Method Details
- 
clamp
public static int clamp(int value, int min, int max)Clamp a value between a minimum and maximum value. If the value exceeds the specified bounds, it will be limited to its exceeding bound.- Parameters:
 value- the value to clampmin- the minimum allowed valuemax- the maximum allowed value- Returns:
 - the clamped value. Itself if the boundaries were not exceeded
 
 - 
clamp
public static double clamp(double value, double min, double max)Clamp a value between a minimum and maximum value. If the value exceeds the specified bounds, it will be limited to its exceeding bound.- Parameters:
 value- the value to clampmin- the minimum allowed valuemax- the maximum allowed value- Returns:
 - the clamped value. Itself if the boundaries were not exceeded
 
 - 
clamp
public static float clamp(float value, float min, float max)Clamp a value between a minimum and maximum value. If the value exceeds the specified bounds, it will be limited to its exceeding bound.- Parameters:
 value- the value to clampmin- the minimum allowed valuemax- the maximum allowed value- Returns:
 - the clamped value. Itself if the boundaries were not exceeded
 
 
 -