<Utility Classes|User's Guide|Line>
FastMath provides a number of convience methods, and where possible faster versions (although this can be at the sake of accuracy).
FastMath provides a number of constants that can help with general math equations. One important attribute is USE_FAST_TRIG if you set this to true, a look-up table will be used for trig functions rather than Java's standard Math library. This provides significant speed increases, but might suffer from accuracy so care should be taken.
There are five major categories of functions that FastMath provides.
cos and acos - provide
cosine and
arc cosine values (make use of the look-up table if
USE_FAST_TRIG is true)
sin and asin - provide
sine and
arc sine values (make use of the look-up table if
USE_FAST_TRIG is true)
-
ceil - provides the ceiling (smallest value that is greater than or equal to a given value and an integer)of a value.
floor - provides the floor (largest value that is less than or equal to a given value and an integer) of a value.
exp - provides the
euler number (e) raised to the provided value.
sqr - provides the square of a value (i.e. value * value).
pow - provides the first given number raised to the second.
isPowerOfTwo - provides a boolean if a value is a power of two or not (e.g. 32, 64, 4).
-
sign - provides the sign of a value (1 if positive, -1 if negative, 0 if 0).
-
-
invSqrt - provides the inverse
square root of a value (1 / sqrt(value).
-
determinant - calculates the
determinant of a 4×4 matrix.
counterClockwise - given three points (defining a triangle), the winding is determined. 1 if counter-clockwise, -1 if clockwise and 0 if the points define a line.
pointInsideTriangle - calculates if a point is inside a triangle.
-
-