java.lang.Object
com.github.stephengold.joltjni.JphMath
Utility methods providing Jolt Physics math functions.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic floataCos(float ratio) Return the inverse cosine of the specified single-precision ratio.static floataTan(float ratio) Return the inverse tangent of the specified single-precision ratio.static floataTan2(float opposite, float adjacent) Return the angle of the specified single-precision right triangle.static floatcos(float angle) Return the cosine of the specified single-precision angle.static floatdegreesToRadians(float degrees) Convert the specified angle from degrees to radians.static floatradiansToDegrees(float radians) Convert the specified angle from radians to degrees.static floatsign(float input) Return the (binary) sign of the specified single-precision value.static floatsin(float angle) Return the sine of the specified single-precision angle.static floatsquare(float value) Return the square of the specified single-precision value.static intsquare(int value) Return the square of the specified integer value.static floattan(float angle) Return the tangent ratio of the specified single-precision angle.
-
Field Details
-
JPH_PI
public static final float JPH_PIsingle-precision value of Pi- See Also:
-
-
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 sideadjacent- 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
-