Skip to main content

Math

Complete API reference for Math, including constructors, attributes, virtual attributes, and methods.

Package: JAVARuntime

Category: Math

Component: no


public class Math

Attributes

NameTypeDescription
PIfloatRepresents the PI value stored on this instance. Read or assign to update the property.
PI2floatRepresents the PI2 value stored on this instance. Read or assign to update the property.
RADIANSfloatRepresents the RADIANS value stored on this instance. Read or assign to update the property.

Static Methods

SignatureReturnsDescription
=(Float.SIZE /)int BYTES_IN_FLOATPerforms the = operation.
=(Integer.SIZE /)int BYTES_IN_INTPerforms the = operation.
=(Short.SIZE /)int BYTES_IN_SHORTPerforms the = operation.
bySecond()floatReturns the value for this frame to reach 1 in one second (using deltaTime).
bySecond(float)floatReturns the value for this frame to reach the specified value in one second (using deltaTime).
sin(float)floatReturns the sine of the angle in degrees.
cos(float)floatReturns the cosine of the angle in degrees.
tan(float)floatReturns the tangent of the angle in degrees.
asin(float)floatReturns the arcsine of the angle in degrees.
acos(float)floatReturns the arccosine of the angle in degrees.
atan(float)floatReturns the arctangent of the angle in degrees.
atan2(float, float)floatReturns the arctangent of y/x in degrees.
sinRad(float)floatReturns the sine of the angle in radians.
cosRad(float)floatReturns the cosine of the angle in radians.
tanRad(float)floatReturns the tangent of the angle in radians.
atan2Rad(float, float)floatReturns the arctangent of y/x in radians.
asinRad(float)floatReturns the arcsine of the angle in radians.
acosRad(float)floatReturns the arccosine of the angle in radians.
atanRad(float)floatReturns the arctangent of the angle in radians.
sqrt(float)floatReturns the square root of the value.
cbrt(float)floatReturns the cubic root of the value.
pow(float, float)floatReturns the value raised to the power of b.
abs(float)floatReturns the absolute value.
abs(int)intReturns the absolute value.
abs(double)doubleReturns the absolute value.
ceil(float)floatReturns the smallest integer greater than or equal to the value.
floor(float)floatReturns the largest integer less than or equal to the value.
round(float)floatRounds the value to the nearest integer.
exp(float)floatReturns Euler's number (e ≈ 2.718) raised to the given value.
log(float)floatReturns the natural logarithm (base e) of the value.
log10(float)floatReturns the base 10 logarithm of the value.
toRadians(float)floatConverts degrees to radians.
toDegrees(float)floatConverts radians to degrees.
dptopx(int)intConverts the value from dp (density-independent pixels) to px (pixels) based on the device screen density.
deadzone(float, float)floatReturns 0 if the value is within the deadzone, otherwise returns the original value.
isOnDeadzone(float, float)booleanChecks if the value is within the deadzone. Returns true if it is, false otherwise.
clamp(float, float, float)floatClamps the value between min and max.
clamp(float, float)floatClamps the value to be at least the specified minimum.
clampMin(float, float)floatClamps the value to be at least the specified minimum.
clamp01(float)floatClamps the value between 0 and 1.
max(float, float)floatReturns the largest value.
max(float...)floatReturns the largest value.
max(int, int)intReturns the largest value.
max(int...)intReturns the largest value.
max(double, double)doubleReturns the largest value.
max(double...)doubleReturns the largest value.
max(long, long)longReturns the largest value.
max(long...)longReturns the largest value.
min(float, float)floatReturns the smallest value.
min(float...)floatReturns the smallest value.
min(int, int)intReturns the smallest value.
min(int...)intReturns the smallest value.
min(double, double)doubleReturns the smallest value.
min(double...)doubleReturns the smallest value.
min(long, long)longReturns the smallest value.
min(long...)longReturns the smallest value.
blend(float, float, float)floatBlends a value towards the target using the specified blend factor (0..1).
lerp(float, float, float)floatInterpolates a value towards the target with the specified speed.
lerpInSeconds(float, float, float)floatInterpolates a value towards the target with the specified speed per second.
negative(boolean)booleanReturns the inverse of the value.
negative(float)floatReturns the negative value.
negative(int)intReturns the negative value.
inverseSQRT(float)floatReturns the inverse square root of the value.
lerpAngle(float, float, float)floatInterpolates between two angles (0-360) with the specified progress, keeping the result in this range.
lerpAngleInSeconds(float, float, float)floatInterpolates between two angles (0-360) with the specified progress per second, keeping the result in this range.
clampAngleTo360(float)floatKeeps the angle between 0 and 360, keeping values in this range.
rangeConverter(float, float, float, float, float)floatConverts a value from the range [oldMin, oldMax] to the range [newMin, newMax].
fixNaN(float)floatReturns 0 if the value is NaN, otherwise returns the specified value.
pitchDegrees(Vector3, Vector3)floatExecutes pitchDegrees and returns after the underlying engine call finishes.
normalizeDeg(float)floatExecutes normalizeDeg and returns after the underlying engine call finishes.
deltaPitchDegrees(float, Vector3, Vector3)floatExecutes deltaPitchDegrees and returns after the underlying engine call finishes.