Skip to main content

Math

class Math

This class represents basic math calculations.


public class Math

— Static Methods (46) —

NameDescription
float bySecond()Executes Time "Time.deltaTime".
float bySecond(float value)Executes Time "Time.deltaTime" multiplied by the value defined to be "value" argument.
float sin(float angle)Returns the sine of the value(angle) in degrees.
float cos(float angle)Returns the cosine of the value(angle) in degrees.
float tan(float angle)Returns the tangent of the value(angle) in degrees.
float asin(float angle)Returns the arcsine of the value (angle), minus the angle in degrees whose sine is the value itself.
float acos(float angle)Returns the arc cosine of the value(angle), minus the angle in degrees whose cosine is the value itself.
float atan(float angle)Returns the arc tangent of the value(angle), minus the angle in degrees whose tangent is the value itself.
float atan2(float x, float y)Returns the value(angle) in degrees whose tangent is the value defined to be argument "x" divided by the argument defined to be argument "y".
float sinRad(float rad)Returns the sine of the value(angle) in radians.
float cosRad(float rad)Returns the cosine of the value(angle) in radians.
float tanRad(float rad)Returns the tangent of the value(angle) in radians.
float atan2Rad(float x, float y)Returns the value(angle) in radians whose tangent is the value defined to be argument "x" divided by the argument defined to be argument "y".
float asinRad(float angle)Returns the arcsine of the value(angle), minus the angle in radians whose sine is the value itself.
float acosRad(float angle)Returns the arc cosine of the value(angle), minus the angle in radians whose cosine is the value itself.
float atanRad(float rad)Returns the arc tangent of the value(angle), minus the angle in radians whose tangent is the value itself.
float sqrt(float value)Returns the square root of the value.
float cbrt(float value)Returns the cube root of the value.
float pow(float value, float b)Raises the number defined to be "value" argument to the one defined to be "b" argument.
float abs(float value)Returns the absolute value of the value.
int abs(int value)Returns the absolute value of the value.
double abs(double value)Returns the absolute value of the value.
float ceil(float value)Returns the smallest integer int greater than or equal to the value.
float floor(float x)Returns the largest integer int that is less than or equal to the value.
float round(float value)Returns the value rounded to the nearest integer int.
float exp(float value)Returns the value raised to the power.
float log(float value)Returns the logarithm of a number with its base.
float log10(float value)Returns the logarithm of a number with its base being 10.
float toRadians(float value)Converts a value(angle) measured in degrees to a value(angle) measured in radians.
float toDegrees(float value)Converts a value(angle) measured in radians to a value(angle) measured in degrees.
int dptopx(int value)Converts(the conversion is done using the screen density of the device) the value in "DPI-Pixels" to "Pixels".
float deadzone(float value, float deadzone)Cuts the value defined to be "value" argument if it is less than the magnitude value defined to be "deadzone" argument.
boolean isOnDeadzone(float value, float deadzone)Returns true if the value defined to be argument "value" is less than the magnitude value defined to be argument "deadzone", false if not.
float clamp(float min, float value, float max)Cuts a number into a minimum value defined to be "min" argument and a maximum value defined to be "max" argument and current value defined to be "value" argument.
float clamp(float min, float value)Cuts a number to a minimum value defined to be "min" argument, and current value defined to be "value" argument.
float lerp(float value, float target, float speed)Transforms a number defined to be "value" argument to one defined to be "target" argument smoothly based on a speed defined to be "speed" argument.
float lerpInSeconds(float value, float target, float speed)Transforms a number defined to be "value" argument to one defined to be "target" argument smoothly based on a speed defined to be "speed" argument multiplied by "Math.bySecond(1)".
boolean negative(boolean value)Returns the inverted value of the boolean.
float negative(float value)Returns the negative value of a number.
int negative(int value)Returns the negative value of a number.
float inverseSQRT(float x)Returns the inverse of the square root of the number float.
float lerpAngle(float value, float target, float progress)Transforms a value defined to be "value" argument to one defined to be "target" argument smoothly based on a speed defined to be "progress" argument, and ensures that the values are interpolated correctly when there is an angle of 360 degrees.
float lerpAngleInSeconds(float value, float target, float progress)Transforms a value defined to be "value" argument to one defined to be "target" argument smoothly based on a speed defined to be "progress" argument multiplied by "Math.bySecond(1)" and ensures that the values are interpolated correctly when there is an angle of 360 degrees.
float clampAngleTo360(float value)Causes the value(angle) to be within the "0 - 360" limit(still has the same resulting rotation).
float rangeConverter(float oldMin, float oldMax, float value, float newMin, float newMax)Converts the minimum values(angle defined to be "value" argument) minimum defined to be argument "oldMin" and maximum argument "oldMax" to the minimum values(angle) defined to be argument "newMin" and maximum to be argument "newMax" within the limit "0 - 360".
float fixNaN(float value)Converts to a number("NaN" is a special value that stands for Not-A-Number).