Class Trigonometry


public final class Trigonometry
Provides fast, approximate trigonometric functions backed by precomputed look-up tables. Useful when many calls are made per frame and the slight approximation error introduced by table look-ups is acceptable.
  • Method Details

    • atan2

      public static float atan2(float y, float x)
      Fast approximation of [double)][Math#atan2(double,] in radians.
      Parameters:
      y - the y component
      x - the x component
      Returns:
      the angle, in radians
    • atan2Deg

      public static float atan2Deg(float y, float x)
      Fast approximation of [double)][Math#atan2(double,] in degrees.
      Parameters:
      y - the y component
      x - the x component
      Returns:
      the angle, in degrees
    • atan2DegStrict

      public static float atan2DegStrict(float y, float x)
      Strict (non-approximated) [double)][Math#atan2(double,] in degrees.
      Parameters:
      y - the y component
      x - the x component
      Returns:
      the angle, in degrees
    • cos

      public static final float cos(float rad)
      Fast approximation of Math.cos(double).
      Parameters:
      rad - the angle, in radians
      Returns:
      the cosine
    • cosDeg

      public static final float cosDeg(float deg)
      Fast approximation of Math.cos(double) accepting degrees.
      Parameters:
      deg - the angle, in degrees
      Returns:
      the cosine
    • sin

      public static final float sin(float rad)
      Fast approximation of Math.sin(double).
      Parameters:
      rad - the angle, in radians
      Returns:
      the sine
    • sinDeg

      public static final float sinDeg(float deg)
      Fast approximation of Math.sin(double) accepting degrees.
      Parameters:
      deg - the angle, in degrees
      Returns:
      the sine