Package net.minestom.server.utils
Class MathUtils
java.lang.Object
net.minestom.server.utils.MathUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic intbitsToRepresent(int n) static doubleclamp(double value, double min, double max) static floatclamp(float value, float min, float max) static intclamp(int value, int min, int max) static DirectiongetHorizontalDirection(float yawInDegrees) static booleanisBetween(byte number, byte min, byte max) static booleanisBetween(double number, double min, double max) static booleanisBetween(float number, float min, float max) static booleanisBetween(int number, int min, int max) static booleanisBetweenUnordered(double number, double compare1, double compare2) static booleanisBetweenUnordered(float number, float compare1, float compare2) static doublemod(double a, double b) static doubleround(double value, int places) static floatround(float value, int places) static doublesquare(double num) static floatsquare(float num) static intsquare(int num)
-
Method Details
-
square
public static int square(int num) -
square
public static float square(float num) -
square
public static double square(double num) -
round
public static double round(double value, int places) -
round
public static float round(float value, int places) -
getHorizontalDirection
-
isBetween
public static boolean isBetween(byte number, byte min, byte max) -
isBetween
public static boolean isBetween(int number, int min, int max) -
isBetween
public static boolean isBetween(double number, double min, double max) -
isBetween
public static boolean isBetween(float number, float min, float max) -
isBetweenUnordered
public static boolean isBetweenUnordered(double number, double compare1, double compare2) -
isBetweenUnordered
public static boolean isBetweenUnordered(float number, float compare1, float compare2) -
clamp
public static int clamp(int value, int min, int max) -
clamp
public static float clamp(float value, float min, float max) -
clamp
public static double clamp(double value, double min, double max) -
mod
public static double mod(double a, double b) -
bitsToRepresent
public static int bitsToRepresent(int n)
-