Class MathUtils

java.lang.Object
net.minestom.server.utils.MathUtils

@Internal public final class MathUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    absMax(double d0, double d1)
     
    static int
     
    static long
    ceilLong(double value)
     
    static double
    clamp(double value, double min, double max)
     
    static float
    clamp(float value, float min, float max)
     
    static int
    clamp(int value, int min, int max)
     
    static Direction
    getHorizontalDirection(float yawInDegrees)
     
    static boolean
    isBetween(byte number, byte min, byte max)
     
    static boolean
    isBetween(double number, double min, double max)
     
    static boolean
    isBetween(float number, float min, float max)
     
    static boolean
    isBetween(int number, int min, int max)
     
    static boolean
    isBetweenUnordered(double number, double compare1, double compare2)
     
    static boolean
    isBetweenUnordered(float number, float compare1, float compare2)
     
    static double
    mod(double a, double b)
     
    static double
    round(double value, int places)
     
    static float
    round(float value, int places)
     
    static double
    square(double num)
     
    static float
    square(float num)
     
    static int
    square(int num)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static Direction getHorizontalDirection(float yawInDegrees)
    • 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)
    • ceilLong

      public static long ceilLong(double value)
    • absMax

      public static double absMax(double d0, double d1)