Package fr.royalpha.revenge.core.util
Class MathUtils
- java.lang.Object
-
- fr.royalpha.revenge.core.util.MathUtils
-
public final class MathUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static floatdegRadstatic floatdegreesToRadiansstatic floatEstatic floatFLOAT_ROUNDING_ERRORstatic floatnanoToSecstatic floatPIstatic floatPI2static floatradDegstatic floatradiansToDegreesstatic java.util.Randomrandomstatic floatSQRT_3
-
Constructor Summary
Constructors Constructor Description MathUtils()
-
Method Summary
Modifier and Type Method Description static doubleangleToXAxis(org.bukkit.util.Vector vector)static floatatan2(float y, float x)static intceil(float x)static intceilPositive(float x)static floatclamp(float value, float min, float max)static intclamp(int value, int min, int max)static shortclamp(short value, short min, short max)static floatcos(float radians)static floatcosDeg(float degrees)static intfloor(float x)static intfloorPositive(float x)static org.bukkit.LocationgetLeftBackSide(org.bukkit.Location location, double distance)static org.bukkit.LocationgetLeftSide(org.bukkit.Location location, double distance)static booleanisEqual(float a, float b)static booleanisEqual(float a, float b, float tolerance)static booleanisPowerOfTwo(int value)static booleanisZero(float value)static booleanisZero(float value, float tolerance)static intnextPowerOfTwo(int value)static floatrandom()static floatrandom(float range)static floatrandom(float start, float end)static intrandom(int range)static intrandom(int start, int end)static booleanrandomBoolean()static booleanrandomBoolean(float chance)static org.bukkit.util.VectorrotateAroundAxisX(org.bukkit.util.Vector v, double angle)static org.bukkit.util.VectorrotateAroundAxisY(org.bukkit.util.Vector v, double angle)static org.bukkit.util.VectorrotateAroundAxisZ(org.bukkit.util.Vector v, double angle)static org.bukkit.util.VectorrotateVector(org.bukkit.util.Vector v, double angleX, double angleY, double angleZ)static intround(float x)static introundPositive(float x)static floatsin(float radians)static floatsinDeg(float degrees)
-
-
-
Field Detail
-
nanoToSec
public static final float nanoToSec
- See Also:
- Constant Field Values
-
FLOAT_ROUNDING_ERROR
public static final float FLOAT_ROUNDING_ERROR
- See Also:
- Constant Field Values
-
PI
public static final float PI
- See Also:
- Constant Field Values
-
PI2
public static final float PI2
- See Also:
- Constant Field Values
-
SQRT_3
public static final float SQRT_3
- See Also:
- Constant Field Values
-
E
public static final float E
- See Also:
- Constant Field Values
-
radiansToDegrees
public static final float radiansToDegrees
- See Also:
- Constant Field Values
-
radDeg
public static final float radDeg
- See Also:
- Constant Field Values
-
degreesToRadians
public static final float degreesToRadians
- See Also:
- Constant Field Values
-
degRad
public static final float degRad
- See Also:
- Constant Field Values
-
random
public static java.util.Random random
-
-
Method Detail
-
sin
public static final float sin(float radians)
-
cos
public static final float cos(float radians)
-
sinDeg
public static final float sinDeg(float degrees)
-
cosDeg
public static final float cosDeg(float degrees)
-
atan2
public static final float atan2(float y, float x)
-
random
public static final int random(int range)
-
random
public static final int random(int start, int end)
-
randomBoolean
public static final boolean randomBoolean()
-
randomBoolean
public static final boolean randomBoolean(float chance)
-
random
public static final float random()
-
random
public static final float random(float range)
-
random
public static final float random(float start, float end)
-
nextPowerOfTwo
public static int nextPowerOfTwo(int value)
-
isPowerOfTwo
public static boolean isPowerOfTwo(int value)
-
clamp
public static int clamp(int value, int min, int max)
-
clamp
public static short clamp(short value, short min, short max)
-
clamp
public static float clamp(float value, float min, float max)
-
floor
public static int floor(float x)
-
floorPositive
public static int floorPositive(float x)
-
ceil
public static int ceil(float x)
-
ceilPositive
public static int ceilPositive(float x)
-
round
public static int round(float x)
-
roundPositive
public static int roundPositive(float x)
-
isZero
public static boolean isZero(float value)
-
isZero
public static boolean isZero(float value, float tolerance)
-
isEqual
public static boolean isEqual(float a, float b)
-
isEqual
public static boolean isEqual(float a, float b, float tolerance)
-
rotateAroundAxisX
public static final org.bukkit.util.Vector rotateAroundAxisX(org.bukkit.util.Vector v, double angle)
-
rotateAroundAxisY
public static final org.bukkit.util.Vector rotateAroundAxisY(org.bukkit.util.Vector v, double angle)
-
rotateAroundAxisZ
public static final org.bukkit.util.Vector rotateAroundAxisZ(org.bukkit.util.Vector v, double angle)
-
rotateVector
public static final org.bukkit.util.Vector rotateVector(org.bukkit.util.Vector v, double angleX, double angleY, double angleZ)
-
angleToXAxis
public static final double angleToXAxis(org.bukkit.util.Vector vector)
-
getLeftSide
public static org.bukkit.Location getLeftSide(org.bukkit.Location location, double distance)
-
getLeftBackSide
public static org.bukkit.Location getLeftBackSide(org.bukkit.Location location, double distance)
-
-