Class MathUtil
java.lang.Object
com.seibel.distanthorizons.coreapi.util.MathUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
ceilDiv
(int value, int divider) Like Math.floorDiv, but reverse in that it is a ceilDivstatic double
clamp
(double min, double value, double max) Clamps the given value between the min and max values.static float
clamp
(float min, float value, float max) Clamps the given value between the min and max values.static int
clamp
(int min, int value, int max) Clamps the given value between the min and max values.static float
fastInvSqrt
(float numb) This is copied from Minecraft's MathHelper classstatic int
log2
(int numb) Equivalent to Log_2(numb)static byte
max
(byte a, byte b) static byte
min
(byte a, byte b) static double
pow2
(double x) static float
pow2
(float x) static int
pow2
(int x) static long
pow2
(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)
-