java.lang.Object
com.github.stephengold.joltjni.JphMath

public final class JphMath extends Object
Utility methods providing Jolt Physics math functions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
    single-precision value of Pi
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    aCos(float ratio)
    Return the inverse cosine of the specified single-precision ratio.
    static float
    aTan(float ratio)
    Return the inverse tangent of the specified single-precision ratio.
    static float
    aTan2(float opposite, float adjacent)
    Return the angle of the specified single-precision right triangle.
    static float
    cos(float angle)
    Return the cosine of the specified single-precision angle.
    static float
    degreesToRadians(float degrees)
    Convert the specified angle from degrees to radians.
    static float
    radiansToDegrees(float radians)
    Convert the specified angle from radians to degrees.
    static float
    sign(float input)
    Return the (binary) sign of the specified single-precision value.
    static float
    sin(float angle)
    Return the sine of the specified single-precision angle.
    static float
    square(float value)
    Return the square of the specified single-precision value.
    static int
    square(int value)
    Return the square of the specified integer value.
    static float
    tan(float angle)
    Return the tangent ratio of the specified single-precision angle.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • aCos

      public static float aCos(float ratio)
      Return the inverse cosine of the specified single-precision ratio. (see Jolt/Math/Trigonometry.h)
      Parameters:
      ratio - the input cosine ratio (≥-1, ≤1)
      Returns:
      the angle (in radians)
    • aTan

      public static float aTan(float ratio)
      Return the inverse tangent of the specified single-precision ratio. (see Jolt/Math/Trigonometry.h)
      Parameters:
      ratio - the input tangent ratio
      Returns:
      the angle (in radians)
    • aTan2

      public static float aTan2(float opposite, float adjacent)
      Return the angle of the specified single-precision right triangle. (see Jolt/Math/Trigonometry.h)
      Parameters:
      opposite - the signed length of the opposite side
      adjacent - the signed length of the adjacent side
      Returns:
      the angle (in radians)
    • cos

      public static float cos(float angle)
      Return the cosine of the specified single-precision angle. (see Jolt/Math/Trigonometry.h)
      Parameters:
      angle - the input angle (in radians)
      Returns:
      the cosine ratio
    • degreesToRadians

      public static float degreesToRadians(float degrees)
      Convert the specified angle from degrees to radians.
      Parameters:
      degrees - the angle to convert (in degrees)
      Returns:
      the converted angle (in radians)
    • radiansToDegrees

      public static float radiansToDegrees(float radians)
      Convert the specified angle from radians to degrees.
      Parameters:
      radians - the angle to convert (in radians)
      Returns:
      the converted angle (in degrees)
    • sign

      public static float sign(float input)
      Return the (binary) sign of the specified single-precision value. (see Jolt/Math/Math.h)
      Parameters:
      input - the input value
      Returns:
      -1 if the input is negative, otherwise +1
    • sin

      public static float sin(float angle)
      Return the sine of the specified single-precision angle. (see Jolt/Math/Trigonometry.h)
      Parameters:
      angle - the input angle (in radians)
      Returns:
      the sine ratio
    • square

      public static float square(float value)
      Return the square of the specified single-precision value.
      Parameters:
      value - the input value
      Returns:
      the square
    • square

      public static int square(int value)
      Return the square of the specified integer value.
      Parameters:
      value - the input value
      Returns:
      the square
    • tan

      public static float tan(float angle)
      Return the tangent ratio of the specified single-precision angle. (see Jolt/Math/Trigonometry.h)
      Parameters:
      angle - the input angle (in radians)
      Returns:
      the tangent ratio