Package org.joml

Class Math



  • public class Math
    extends Object
    Contains fast approximations of some Math operations.

    By default, Math methods will be used by all other JOML classes. In order to use the approximations in this class, start the JVM with the parameter -Djoml.fastmath.

    There are two algorithms for approximating sin/cos:

    1. arithmetic polynomial approximation contributed by roquendm
    2. theagentd's linear interpolation variant of Riven's algorithm from http://www.java-gaming.org/
    By default, the first algorithm is being used. In order to use the second one, start the JVM with -Djoml.sinLookup. The lookup table bit length of the second algorithm can also be adjusted for improved accuracy via -Djoml.sinLookup.bits=<n>, where <n> is the number of bits of the lookup table.
    Author:
    Kai Burjack
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double PI  
    • Constructor Summary

      Constructors 
      Constructor Description
      Math​()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double abs​(double r)  
      static float abs​(float r)  
      static int abs​(int r)  
      static double acos​(double r)  
      static double asin​(double r)  
      static double atan2​(double y, double x)  
      static double ceil​(double v)  
      static float ceil​(float v)  
      static double cos​(double rad)  
      static double cosFromSin​(double sin, double angle)  
      static double exp​(double a)  
      static double floor​(double v)  
      static float floor​(float v)  
      static double fma​(double a, double b, double c)  
      static float fma​(float a, float b, float c)  
      static boolean isFinite​(double d)  
      static boolean isFinite​(float f)  
      static double max​(double a, double b)  
      static float max​(float a, float b)  
      static int max​(int x, int y)  
      static double min​(double a, double b)  
      static float min​(float a, float b)  
      static int min​(int x, int y)  
      static long round​(double v)  
      static int round​(float v)  
      static double safeAcos​(double v)  
      static double sin​(double rad)  
      static double sqrt​(double r)  
      static double tan​(double r)  
      static double toDegrees​(double angles)  
      static double toRadians​(double angles)  
    • Constructor Detail

      • Math

        public Math​()
    • Method Detail

      • sin

        public static double sin​(double rad)
      • cos

        public static double cos​(double rad)
      • cosFromSin

        public static double cosFromSin​(double sin,
                                        double angle)
      • sqrt

        public static double sqrt​(double r)
      • tan

        public static double tan​(double r)
      • acos

        public static double acos​(double r)
      • safeAcos

        public static double safeAcos​(double v)
      • atan2

        public static double atan2​(double y,
                                   double x)
      • asin

        public static double asin​(double r)
      • abs

        public static double abs​(double r)
      • abs

        public static float abs​(float r)
      • abs

        public static int abs​(int r)
      • max

        public static int max​(int x,
                              int y)
      • min

        public static int min​(int x,
                              int y)
      • min

        public static float min​(float a,
                                float b)
      • max

        public static float max​(float a,
                                float b)
      • min

        public static double min​(double a,
                                 double b)
      • max

        public static double max​(double a,
                                 double b)
      • toRadians

        public static double toRadians​(double angles)
      • toDegrees

        public static double toDegrees​(double angles)
      • floor

        public static double floor​(double v)
      • floor

        public static float floor​(float v)
      • ceil

        public static double ceil​(double v)
      • ceil

        public static float ceil​(float v)
      • round

        public static long round​(double v)
      • round

        public static int round​(float v)
      • exp

        public static double exp​(double a)
      • isFinite

        public static boolean isFinite​(double d)
      • isFinite

        public static boolean isFinite​(float f)
      • fma

        public static float fma​(float a,
                                float b,
                                float c)
      • fma

        public static double fma​(double a,
                                 double b,
                                 double c)