Class MathUtil
java.lang.Object
com.seibel.distanthorizons.coreapi.util.MathUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intceilDiv(int value, int divider) Like Math.floorDiv, but reverse in that it is a ceilDivstatic doubleclamp(double min, double value, double max) Clamps the given value between the min and max values.static floatclamp(float min, float value, float max) Clamps the given value between the min and max values.static intclamp(int min, int value, int max) Clamps the given value between the min and max values.static floatfastInvSqrt(float numb) This is copied from Minecraft's MathHelper classstatic intlog2(int numb) Equivalent to Log_2(numb)static bytemax(byte a, byte b) static bytemin(byte a, byte b) static doublepow2(double x) static floatpow2(float x) static intpow2(int x) static longpow2(long x)
-
Constructor Details
-
MathUtil
public MathUtil()
-
-
Method Details
-
clamp
public static int clamp(int min, int value, int max) Clamps the given value between the min and max values. May behave strangely if min > max. -
clamp
public static float clamp(float min, float value, float max) Clamps the given value between the min and max values. May behave strangely if min > max. -
clamp
public static double clamp(double min, double value, double max) Clamps the given value between the min and max values. May behave strangely if min > max. -
ceilDiv
public static int ceilDiv(int value, int divider) Like Math.floorDiv, but reverse in that it is a ceilDiv -
min
public static byte min(byte a, byte b) -
max
public static byte max(byte a, byte b) -
fastInvSqrt
public static float fastInvSqrt(float numb) This is copied from Minecraft's MathHelper class -
pow2
public static float pow2(float x) -
pow2
public static double pow2(double x) -
pow2
public static int pow2(int x) -
pow2
public static long pow2(long x) -
log2
public static int log2(int numb) Equivalent to Log_2(numb)
-