com.jme3.math

## Class FastMath

• java.lang.Object
• com.jme3.math.FastMath

• ```public final class FastMath
extends java.lang.Object```
`FastMath` provides 'fast' math approximations and float equivalents of Math functions. These are all used as static values and functions.
• ### Field Summary

Fields
Modifier and Type Field and Description
`static double` `DBL_EPSILON`
A "close to zero" double epsilon value for use
`static float` `DEG_TO_RAD`
A value to multiply a degree value by, to convert it to radians.
`static float` `FLT_EPSILON`
A "close to zero" float epsilon value for use
`static float` `HALF_PI`
The value PI/2 as a float.
`static float` `INV_PI`
The value 1/PI as a float.
`static float` `INV_TWO_PI`
The value 1/(2PI) as a float.
`static float` `ONE_THIRD`
The value 1/3, as a float.
`static float` `PI`
The value PI as a float.
`static float` `QUARTER_PI`
The value PI/4 as a float.
`static float` `RAD_TO_DEG`
A value to multiply a radian value by, to convert it to degrees.
`static java.util.Random` `rand`
A precreated random object for random numbers.
`static float` `TWO_PI`
The value 2PI as a float.
`static float` `ZERO_TOLERANCE`
A "close to zero" float epsilon value for use
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static float` `abs(float fValue)`
Returns Absolute value of a float.
`static float` `acos(float fValue)`
Returns the arc cosine of a value.
Special cases: If fValue is smaller than -1, then the result is PI.
`static boolean` ```approximateEquals(float a, float b)```
Determine if two floats are approximately equal.
`static float` `asin(float fValue)`
Returns the arc sine of a value.
Special cases: If fValue is smaller than -1, then the result is -HALF_PI.
`static float` `atan(float fValue)`
Returns the arc tangent of an angle given in radians.
`static float` ```atan2(float fY, float fX)```
A direct call to Math.atan2.
`static Vector3f` ```cartesianToSpherical(Vector3f cartCoords, Vector3f store)```
Converts a point from Cartesian coordinates (using positive Y as up) to Spherical and stores the results in the store var.
`static Vector3f` ```cartesianZToSpherical(Vector3f cartCoords, Vector3f store)```
Converts a point from Cartesian coordinates (using positive Z as up) to Spherical and stores the results in the store var.
`static float` `ceil(float fValue)`
Rounds a fValue up.
`static float` ```clamp(float input, float min, float max)```
Take a float input and clamp it between min and max.
`static Vector3f` ```computeNormal(Vector3f v1, Vector3f v2, Vector3f v3)```
A method that computes normal for a triangle defined by three vertices.
`static short` `convertFloatToHalf(float flt)`
Convert a single-precision (32-bit) floating-point value to half precision.
`static float` `convertHalfToFloat(short half)`
Converts a single precision (32 bit) floating point value into half precision (16 bit).
`static float` ```copysign(float x, float y)```
`static float` `cos(float v)`
Returns cosine of an angle.
`static int` ```counterClockwise(Vector2f p0, Vector2f p1, Vector2f p2)```
Given 3 points in a 2d plane, this function computes if the points going from A-B-C are moving counter clock wise.
`static float` ```determinant(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)```
Returns the determinant of a 4x4 matrix.
`static float` `exp(float fValue)`
Returns E^fValue
`static float` ```extrapolateLinear(float scale, float startValue, float endValue)```
Linear extrapolation from startValue to endValue by the given scale.
`static Vector3f` ```extrapolateLinear(float scale, Vector3f startValue, Vector3f endValue)```
Linear extrapolation from startValue to endValue by the given scale.
`static Vector3f` ```extrapolateLinear(float scale, Vector3f startValue, Vector3f endValue, Vector3f store)```
Linear extrapolation from startValue to endValue by the given scale.
`static float` `fastInvSqrt(float x)`
Quickly estimate 1/sqrt(fValue).
`static float` `floor(float fValue)`
Returns a number rounded down.
`static float` ```getBezierP1toP2Length(Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3)```
Compute the length on a Bezier spline between control points 1 and 2.
`static float` ```getCatmullRomP1toP2Length(Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3, float startRange, float endRange, float curveTension)```
Compute the length of a Catmull–Rom spline between control points 1 and 2
`static float` ```interpolateBezier(float u, float p0, float p1, float p2, float p3)```
Interpolate a spline between at least 4 control points following the Bezier equation.
`static Vector3f` ```interpolateBezier(float u, Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3)```
Interpolate a spline between at least 4 control points following the Bezier equation.
`static Vector3f` ```interpolateBezier(float u, Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3, Vector3f store)```
Interpolate a spline between at least 4 control points following the Bezier equation.
`static float` ```interpolateCatmullRom(float u, float T, float p0, float p1, float p2, float p3)```
Interpolate a spline between at least 4 control points following the Catmull-Rom equation.
`static Vector3f` ```interpolateCatmullRom(float u, float T, Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3)```
Interpolate a spline between at least 4 control points using the Catmull-Rom equation.
`static Vector3f` ```interpolateCatmullRom(float u, float T, Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3, Vector3f store)```
Interpolate a spline between at least 4 control points following the Catmull-Rom equation.
`static float` ```interpolateLinear(float scale, float startValue, float endValue)```
Linear interpolation from startValue to endValue by the given percent.
`static Vector3f` ```interpolateLinear(float scale, Vector3f startValue, Vector3f endValue)```
Linear interpolation from startValue to endValue by the given percent.
`static Vector3f` ```interpolateLinear(float scale, Vector3f startValue, Vector3f endValue, Vector3f store)```
Linear interpolation from startValue to endValue by the given percent.
`static float` `invSqrt(float fValue)`
Returns 1/sqrt(fValue)
`static boolean` `isPowerOfTwo(int number)`
Returns true if the number is a power of 2 (2,4,8,16...) A good implementation found on the Java boards.
`static float` `log(float fValue)`
Returns the log base E of a value.
`static float` ```log(float value, float base)```
Returns the logarithm of value with given base, calculated as log(value)/log(base), so that pow(base, return)==value (contributed by vear)
`static int` `nearestPowerOfTwo(int number)`
Get the next power of two of the given number.
`static float` `nextRandomFloat()`
Returns a random float between 0 and 1.
`static int` `nextRandomInt()`
Choose a pseudo-random, uniformly-distributed integer value from the shared generator.
`static int` ```nextRandomInt(int min, int max)```
Returns a random integer between min and max.
`static float` ```normalize(float val, float min, float max)```
Takes a value and expresses it in terms of min to max.
`static int` ```pointInsideTriangle(Vector2f t0, Vector2f t1, Vector2f t2, Vector2f p)```
Test if a point is inside a triangle.
`static float` ```pow(float fBase, float fExponent)```
Returns a number raised to an exponent power.
`static float` `saturate(float input)`
Clamps the given float to be between 0 and 1.
`static float` `sign(float fValue)`
Returns 1 if the number is positive, -1 if the number is negative, and 0 otherwise
`static int` `sign(int iValue)`
Returns 1 if the number is positive, -1 if the number is negative, and 0 otherwise
`static float` `sin(float v)`
Returns the sine of an angle.
`static Vector3f` ```sphericalToCartesian(Vector3f sphereCoords, Vector3f store)```
Converts a point from Spherical coordinates to Cartesian (using positive Y as up) and stores the results in the store var.
`static Vector3f` ```sphericalToCartesianZ(Vector3f sphereCoords, Vector3f store)```
Converts a point from Spherical coordinates to Cartesian (using positive Z as up) and stores the results in the store var.
`static float` `sqr(float fValue)`
Returns the value squared.
`static float` `sqrt(float fValue)`
Returns the square root of a given value.
`static float` `tan(float fValue)`
Returns the tangent of the specified angle.
`static float` ```unInterpolateLinear(float value, float min, float max)```
Converts a range of min/max to a 0-1 range.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### DBL_EPSILON

`public static final double DBL_EPSILON`
A "close to zero" double epsilon value for use
Constant Field Values
• #### FLT_EPSILON

`public static final float FLT_EPSILON`
A "close to zero" float epsilon value for use
Constant Field Values
• #### ZERO_TOLERANCE

`public static final float ZERO_TOLERANCE`
A "close to zero" float epsilon value for use
Constant Field Values
• #### ONE_THIRD

`public static final float ONE_THIRD`
The value 1/3, as a float.
Constant Field Values
• #### PI

`public static final float PI`
The value PI as a float. (180 degrees)
Constant Field Values
• #### TWO_PI

`public static final float TWO_PI`
The value 2PI as a float. (360 degrees)
Constant Field Values
• #### HALF_PI

`public static final float HALF_PI`
The value PI/2 as a float. (90 degrees)
Constant Field Values
• #### QUARTER_PI

`public static final float QUARTER_PI`
The value PI/4 as a float. (45 degrees)
Constant Field Values
• #### INV_PI

`public static final float INV_PI`
The value 1/PI as a float.
Constant Field Values
• #### INV_TWO_PI

`public static final float INV_TWO_PI`
The value 1/(2PI) as a float.
Constant Field Values

`public static final float DEG_TO_RAD`
A value to multiply a degree value by, to convert it to radians.
Constant Field Values

`public static final float RAD_TO_DEG`
A value to multiply a radian value by, to convert it to degrees.
Constant Field Values
• #### rand

`public static final java.util.Random rand`
A precreated random object for random numbers.
• ### Method Detail

• #### isPowerOfTwo

`public static boolean isPowerOfTwo(int number)`
Returns true if the number is a power of 2 (2,4,8,16...) A good implementation found on the Java boards. note: a number is a power of two if and only if it is the smallest number with that number of significant bits. Therefore, if you subtract 1, you know that the new number will have fewer bits, so ANDing the original number with anything less than it will give 0.
Parameters:
`number` - The number to test.
Returns:
True if it is a power of two.
• #### nearestPowerOfTwo

`public static int nearestPowerOfTwo(int number)`
Get the next power of two of the given number. E.g. for an input 100, this returns 128. Returns 1 for all numbers less than or equal to 1.
Parameters:
`number` - The number to obtain the POT for.
Returns:
The next power of two.
• #### interpolateLinear

```public static float interpolateLinear(float scale,
float startValue,
float endValue)```
Linear interpolation from startValue to endValue by the given percent. Basically: ((1 - percent) * startValue) + (percent * endValue)
Parameters:
`scale` - scale value to use. if 1, use endValue, if 0, use startValue.
`startValue` - Beginning value. 0% of f
`endValue` - ending value. 100% of f
Returns:
The interpolated value between startValue and endValue.
• #### interpolateLinear

```public static Vector3f interpolateLinear(float scale,
Vector3f startValue,
Vector3f endValue,
Vector3f store)```
Linear interpolation from startValue to endValue by the given percent. Basically: ((1 - percent) * startValue) + (percent * endValue)
Parameters:
`scale` - scale value to use. if 1, use endValue, if 0, use startValue.
`startValue` - Beginning value. 0% of f
`endValue` - ending value. 100% of f
`store` - a vector3f to store the result
Returns:
The interpolated value between startValue and endValue.
• #### interpolateLinear

```public static Vector3f interpolateLinear(float scale,
Vector3f startValue,
Vector3f endValue)```
Linear interpolation from startValue to endValue by the given percent. Basically: ((1 - percent) * startValue) + (percent * endValue)
Parameters:
`scale` - scale value to use. if 1, use endValue, if 0, use startValue.
`startValue` - Beginning value. 0% of f
`endValue` - ending value. 100% of f
Returns:
The interpolated value between startValue and endValue.
• #### extrapolateLinear

```public static float extrapolateLinear(float scale,
float startValue,
float endValue)```
Linear extrapolation from startValue to endValue by the given scale. if scale is between 0 and 1 this method returns the same result as interpolateLinear if the scale is over 1 the value is linearly extrapolated. Note that the end value is the value for a scale of 1.
Parameters:
`scale` - the scale for extrapolation
`startValue` - the starting value (scale = 0)
`endValue` - the end value (scale = 1)
Returns:
an extrapolation for the given parameters
• #### extrapolateLinear

```public static Vector3f extrapolateLinear(float scale,
Vector3f startValue,
Vector3f endValue,
Vector3f store)```
Linear extrapolation from startValue to endValue by the given scale. if scale is between 0 and 1 this method returns the same result as interpolateLinear if the scale is over 1 the value is linearly extrapolated. Note that the end value is the value for a scale of 1.
Parameters:
`scale` - the scale for extrapolation
`startValue` - the starting value (scale = 0)
`endValue` - the end value (scale = 1)
`store` - an initialized vector to store the return value
Returns:
an extrapolation for the given parameters
• #### extrapolateLinear

```public static Vector3f extrapolateLinear(float scale,
Vector3f startValue,
Vector3f endValue)```
Linear extrapolation from startValue to endValue by the given scale. if scale is between 0 and 1 this method returns the same result as interpolateLinear if the scale is over 1 the value is linearly extrapolated. Note that the end value is the value for a scale of 1.
Parameters:
`scale` - the scale for extrapolation
`startValue` - the starting value (scale = 0)
`endValue` - the end value (scale = 1)
Returns:
an extrapolation for the given parameters
• #### interpolateCatmullRom

```public static float interpolateCatmullRom(float u,
float T,
float p0,
float p1,
float p2,
float p3)```
Interpolate a spline between at least 4 control points following the Catmull-Rom equation. here is the interpolation matrix m = [ 0.0 1.0 0.0 0.0 ] [-T 0.0 T 0.0 ] [ 2T T-3 3-2T -T ] [-T 2-T T-2 T ] where T is the curve tension the result is a value between p1 and p2, t=0 for p1, t=1 for p2
Parameters:
`u` - value from 0 to 1
`T` - The tension of the curve
`p0` - control point 0
`p1` - control point 1
`p2` - control point 2
`p3` - control point 3
Returns:
Catmull–Rom interpolation
• #### interpolateCatmullRom

```public static Vector3f interpolateCatmullRom(float u,
float T,
Vector3f p0,
Vector3f p1,
Vector3f p2,
Vector3f p3,
Vector3f store)```
Interpolate a spline between at least 4 control points following the Catmull-Rom equation. here is the interpolation matrix m = [ 0.0 1.0 0.0 0.0 ] [-T 0.0 T 0.0 ] [ 2T T-3 3-2T -T ] [-T 2-T T-2 T ] where T is the tension of the curve the result is a value between p1 and p2, t=0 for p1, t=1 for p2
Parameters:
`u` - value from 0 to 1
`T` - The tension of the curve
`p0` - control point 0
`p1` - control point 1
`p2` - control point 2
`p3` - control point 3
`store` - a Vector3f to store the result
Returns:
Catmull–Rom interpolation
• #### interpolateCatmullRom

```public static Vector3f interpolateCatmullRom(float u,
float T,
Vector3f p0,
Vector3f p1,
Vector3f p2,
Vector3f p3)```
Interpolate a spline between at least 4 control points using the Catmull-Rom equation. Here is the interpolation matrix: m = [ 0.0 1.0 0.0 0.0 ] [-T 0.0 T 0.0 ] [ 2T T-3 3-2T -T ] [-T 2-T T-2 T ] where T is the tension of the curve the result is a value between p1 and p2, t=0 for p1, t=1 for p2
Parameters:
`u` - value from 0 to 1
`T` - The tension of the curve
`p0` - control point 0
`p1` - control point 1
`p2` - control point 2
`p3` - control point 3
Returns:
Catmull–Rom interpolation
• #### interpolateBezier

```public static float interpolateBezier(float u,
float p0,
float p1,
float p2,
float p3)```
Interpolate a spline between at least 4 control points following the Bezier equation. here is the interpolation matrix m = [ -1.0 3.0 -3.0 1.0 ] [ 3.0 -6.0 3.0 0.0 ] [ -3.0 3.0 0.0 0.0 ] [ 1.0 0.0 0.0 0.0 ] where T is the curve tension the result is a value between p1 and p3, t=0 for p1, t=1 for p3
Parameters:
`u` - value from 0 to 1
`p0` - control point 0
`p1` - control point 1
`p2` - control point 2
`p3` - control point 3
Returns:
Bezier interpolation
• #### interpolateBezier

```public static Vector3f interpolateBezier(float u,
Vector3f p0,
Vector3f p1,
Vector3f p2,
Vector3f p3,
Vector3f store)```
Interpolate a spline between at least 4 control points following the Bezier equation. here is the interpolation matrix m = [ -1.0 3.0 -3.0 1.0 ] [ 3.0 -6.0 3.0 0.0 ] [ -3.0 3.0 0.0 0.0 ] [ 1.0 0.0 0.0 0.0 ] where T is the tension of the curve the result is a value between p1 and p3, t=0 for p1, t=1 for p3
Parameters:
`u` - value from 0 to 1
`p0` - control point 0
`p1` - control point 1
`p2` - control point 2
`p3` - control point 3
`store` - a Vector3f to store the result
Returns:
Bezier interpolation
• #### interpolateBezier

```public static Vector3f interpolateBezier(float u,
Vector3f p0,
Vector3f p1,
Vector3f p2,
Vector3f p3)```
Interpolate a spline between at least 4 control points following the Bezier equation. here is the interpolation matrix m = [ -1.0 3.0 -3.0 1.0 ] [ 3.0 -6.0 3.0 0.0 ] [ -3.0 3.0 0.0 0.0 ] [ 1.0 0.0 0.0 0.0 ] where T is the tension of the curve the result is a value between p1 and p3, t=0 for p1, t=1 for p3
Parameters:
`u` - value from 0 to 1
`p0` - control point 0
`p1` - control point 1
`p2` - control point 2
`p3` - control point 3
Returns:
Bezier interpolation
• #### getCatmullRomP1toP2Length

```public static float getCatmullRomP1toP2Length(Vector3f p0,
Vector3f p1,
Vector3f p2,
Vector3f p3,
float startRange,
float endRange,
float curveTension)```
Compute the length of a Catmull–Rom spline between control points 1 and 2
Parameters:
`p0` - control point 0
`p1` - control point 1
`p2` - control point 2
`p3` - control point 3
`startRange` - the starting range on the segment (use 0)
`endRange` - the end range on the segment (use 1)
`curveTension` - the curve tension
Returns:
the length of the segment
• #### getBezierP1toP2Length

```public static float getBezierP1toP2Length(Vector3f p0,
Vector3f p1,
Vector3f p2,
Vector3f p3)```
Compute the length on a Bezier spline between control points 1 and 2.
Parameters:
`p0` - control point 0
`p1` - control point 1
`p2` - control point 2
`p3` - control point 3
Returns:
the length of the segment
• #### acos

`public static float acos(float fValue)`
Returns the arc cosine of a value.
Special cases:
• If fValue is smaller than -1, then the result is PI.
• If the argument is greater than 1, then the result is 0.
Parameters:
`fValue` - The value to arc cosine.
Returns:
`Math.acos(double)`
• #### asin

`public static float asin(float fValue)`
Returns the arc sine of a value.
Special cases:
• If fValue is smaller than -1, then the result is -HALF_PI.
• If the argument is greater than 1, then the result is HALF_PI.
Parameters:
`fValue` - The value to arc sine.
Returns:
`Math.asin(double)`
• #### atan

`public static float atan(float fValue)`
Returns the arc tangent of an angle given in radians.
Parameters:
`fValue` - The angle, in radians.
Returns:
fValue's atan
`Math.atan(double)`
• #### atan2

```public static float atan2(float fY,
float fX)```
A direct call to Math.atan2.
Parameters:
`fY` - ordinate
`fX` - abscissa
Returns:
Math.atan2(fY,fX)
`Math.atan2(double, double)`
• #### ceil

`public static float ceil(float fValue)`
Rounds a fValue up. A call to Math.ceil
Parameters:
`fValue` - The value.
Returns:
The fValue rounded up
`Math.ceil(double)`
• #### cos

`public static float cos(float v)`
Returns cosine of an angle. Direct call to java.lang.Math
Parameters:
`v` - The angle to cosine.
Returns:
the cosine of the angle.
`Math.cos(double)`
• #### sin

`public static float sin(float v)`
Returns the sine of an angle. Direct call to java.lang.Math
Parameters:
`v` - The angle to sine.
Returns:
the sine of the angle.
`Math.sin(double)`
• #### exp

`public static float exp(float fValue)`
Returns E^fValue
Parameters:
`fValue` - Value to raise to a power.
Returns:
The value E^fValue
`Math.exp(double)`
• #### abs

`public static float abs(float fValue)`
Returns Absolute value of a float.
Parameters:
`fValue` - The value to abs.
Returns:
The abs of the value.
`Math.abs(float)`
• #### floor

`public static float floor(float fValue)`
Returns a number rounded down.
Parameters:
`fValue` - The value to round
Returns:
The given number rounded down
`Math.floor(double)`
• #### invSqrt

`public static float invSqrt(float fValue)`
Returns 1/sqrt(fValue)
Parameters:
`fValue` - The value to process.
Returns:
1/sqrt(fValue)
`Math.sqrt(double)`
• #### fastInvSqrt

`public static float fastInvSqrt(float x)`
Quickly estimate 1/sqrt(fValue).
Parameters:
`x` - the input value (≥0)
Returns:
an approximate value for 1/sqrt(x)
• #### log

`public static float log(float fValue)`
Returns the log base E of a value.
Parameters:
`fValue` - The value to log.
Returns:
The log of fValue base E
`Math.log(double)`
• #### log

```public static float log(float value,
float base)```
Returns the logarithm of value with given base, calculated as log(value)/log(base), so that pow(base, return)==value (contributed by vear)
Parameters:
`value` - The value to log.
`base` - Base of logarithm.
Returns:
The logarithm of value with given base
• #### pow

```public static float pow(float fBase,
float fExponent)```
Returns a number raised to an exponent power. fBase^fExponent
Parameters:
`fBase` - The base value (IE 2)
`fExponent` - The exponent value (IE 3)
Returns:
base raised to exponent (IE 8)
`Math.pow(double, double)`
• #### sqr

`public static float sqr(float fValue)`
Returns the value squared. fValue ^ 2
Parameters:
`fValue` - The value to square.
Returns:
The square of the given value.
• #### sqrt

`public static float sqrt(float fValue)`
Returns the square root of a given value.
Parameters:
`fValue` - The value to sqrt.
Returns:
The square root of the given value.
`Math.sqrt(double)`
• #### tan

`public static float tan(float fValue)`
Returns the tangent of the specified angle.
Parameters:
`fValue` - The value to tangent, in radians.
Returns:
The tangent of fValue.
`Math.tan(double)`
• #### sign

`public static int sign(int iValue)`
Returns 1 if the number is positive, -1 if the number is negative, and 0 otherwise
Parameters:
`iValue` - The integer to examine.
Returns:
The integer's sign.
• #### sign

`public static float sign(float fValue)`
Returns 1 if the number is positive, -1 if the number is negative, and 0 otherwise
Parameters:
`fValue` - The float to examine.
Returns:
The float's sign.
• #### counterClockwise

```public static int counterClockwise(Vector2f p0,
Vector2f p1,
Vector2f p2)```
Given 3 points in a 2d plane, this function computes if the points going from A-B-C are moving counter clock wise.
Parameters:
`p0` - Point 0.
`p1` - Point 1.
`p2` - Point 2.
Returns:
1 If they are CCW, -1 if they are not CCW, 0 if p2 is between p0 and p1.
• #### pointInsideTriangle

```public static int pointInsideTriangle(Vector2f t0,
Vector2f t1,
Vector2f t2,
Vector2f p)```
Test if a point is inside a triangle. 1 if the point is on the ccw side, -1 if the point is on the cw side, and 0 if it is on neither.
Parameters:
`t0` - First point of the triangle.
`t1` - Second point of the triangle.
`t2` - Third point of the triangle.
`p` - The point to test.
Returns:
Value 1 or -1 if inside triangle, 0 otherwise.
• #### computeNormal

```public static Vector3f computeNormal(Vector3f v1,
Vector3f v2,
Vector3f v3)```
A method that computes normal for a triangle defined by three vertices.
Parameters:
`v1` - first vertex
`v2` - second vertex
`v3` - third vertex
Returns:
a normal for the face
• #### determinant

```public static float determinant(double m00,
double m01,
double m02,
double m03,
double m10,
double m11,
double m12,
double m13,
double m20,
double m21,
double m22,
double m23,
double m30,
double m31,
double m32,
double m33)```
Returns the determinant of a 4x4 matrix.
Parameters:
`m00` - the element in row 0, column 0 of the matrix
`m01` - the element in row 0, column 1 of the matrix
`m02` - the element in row 0, column 2 of the matrix
`m03` - the element in row 0, column 3 of the matrix
`m10` - the element in row 1, column 0 of the matrix
`m11` - the element in row 1, column 1 of the matrix
`m12` - the element in row 1, column 2 of the matrix
`m13` - the element in row 1, column 3 of the matrix
`m20` - the element in row 2, column 0 of the matrix
`m21` - the element in row 2, column 1 of the matrix
`m22` - the element in row 2, column 2 of the matrix
`m23` - the element in row 2, column 3 of the matrix
`m30` - the element in row 3, column 0 of the matrix
`m31` - the element in row 3, column 1 of the matrix
`m32` - the element in row 3, column 2 of the matrix
`m33` - the element in row 3, column 3 of the matrix
Returns:
the determinant
• #### nextRandomFloat

`public static float nextRandomFloat()`
Returns a random float between 0 and 1.
Returns:
a random float between 0 (inclusive) and 1 (exclusive)
• #### nextRandomInt

```public static int nextRandomInt(int min,
int max)```
Returns a random integer between min and max.
Parameters:
`min` - the desired minimum value
`max` - the desired maximum value
Returns:
a random int between min (inclusive) and max (inclusive)
• #### nextRandomInt

`public static int nextRandomInt()`
Choose a pseudo-random, uniformly-distributed integer value from the shared generator.
Returns:
the next integer value
• #### sphericalToCartesian

```public static Vector3f sphericalToCartesian(Vector3f sphereCoords,
Vector3f store)```
Converts a point from Spherical coordinates to Cartesian (using positive Y as up) and stores the results in the store var.
Parameters:
`sphereCoords` - the input spherical coordinates: x=distance from origin, y=longitude in radians, z=latitude in radians (not null, unaffected)
`store` - storage for the result (modified if not null)
Returns:
the Cartesian coordinates (either store or a new vector)
• #### cartesianToSpherical

```public static Vector3f cartesianToSpherical(Vector3f cartCoords,
Vector3f store)```
Converts a point from Cartesian coordinates (using positive Y as up) to Spherical and stores the results in the store var. (Radius, Azimuth, Polar)
Parameters:
`cartCoords` - the input Cartesian coordinates (not null, unaffected)
`store` - storage for the result (modified if not null)
Returns:
the Cartesian coordinates: x=distance from origin, y=longitude in radians, z=latitude in radians (either store or a new vector)
• #### sphericalToCartesianZ

```public static Vector3f sphericalToCartesianZ(Vector3f sphereCoords,
Vector3f store)```
Converts a point from Spherical coordinates to Cartesian (using positive Z as up) and stores the results in the store var.
Parameters:
`sphereCoords` - the input spherical coordinates: x=distance from origin, y=latitude in radians, z=longitude in radians (not null, unaffected)
`store` - storage for the result (modified if not null)
Returns:
the Cartesian coordinates (either store or a new vector)
• #### cartesianZToSpherical

```public static Vector3f cartesianZToSpherical(Vector3f cartCoords,
Vector3f store)```
Converts a point from Cartesian coordinates (using positive Z as up) to Spherical and stores the results in the store var. (Radius, Azimuth, Polar)
Parameters:
`cartCoords` - the input Cartesian coordinates (not null, unaffected)
`store` - storage for the result (modified if not null)
Returns:
the Cartesian coordinates: x=distance from origin, y=latitude in radians, z=longitude in radians (either store or a new vector)
• #### normalize

```public static float normalize(float val,
float min,
float max)```
Takes a value and expresses it in terms of min to max.
Parameters:
`val` - - the angle to normalize (in radians)
`min` - the lower limit of the range
`max` - the upper limit of the range
Returns:
the normalized angle (also in radians)
• #### copysign

```public static float copysign(float x,
float y)```
Parameters:
`x` - the value whose sign is to be adjusted.
`y` - the value whose sign is to be used.
Returns:
x with its sign changed to match the sign of y.
• #### clamp

```public static float clamp(float input,
float min,
float max)```
Take a float input and clamp it between min and max.
Parameters:
`input` - the value to be clamped
`min` - the minimum output value
`max` - the maximum output value
Returns:
clamped input
• #### saturate

`public static float saturate(float input)`
Clamps the given float to be between 0 and 1.
Parameters:
`input` - the value to be clamped
Returns:
input clamped between 0 and 1.
• #### approximateEquals

```public static boolean approximateEquals(float a,
float b)```
Determine if two floats are approximately equal. This takes into account the magnitude of the floats, since large numbers will have larger differences be close to each other. Should return true for a=100000, b=100001, but false for a=10000, b=10001.
Parameters:
`a` - The first float to compare
`b` - The second float to compare
Returns:
True if a and b are approximately equal, false otherwise.
• #### convertHalfToFloat

`public static float convertHalfToFloat(short half)`
Converts a single precision (32 bit) floating point value into half precision (16 bit).
Parameters:
`half` - The half floating point value as a short.
Returns:
floating point value of the half.
• #### convertFloatToHalf

`public static short convertFloatToHalf(float flt)`
Convert a single-precision (32-bit) floating-point value to half precision.
Parameters:
`flt` - the input value (not a NaN)
Returns:
a near-equivalent value in half precision
Throws:
`java.lang.UnsupportedOperationException` - if flt is a NaN
• #### unInterpolateLinear

```public static float unInterpolateLinear(float value,
float min,
float max)```
Converts a range of min/max to a 0-1 range.
Parameters:
`value` - the value between min-max (inclusive).
`min` - the minimum of the range.
`max` - the maximum of the range.
Returns:
A value between 0-1 if the given value is between min/max.