Open 3D Engine EMotionFX Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <FastMath.h>
Public Member Functions | |
template<typename T > | |
MCORE_INLINE T | Align (T inValue, T alignment) |
Static Public Member Functions | |
static MCORE_INLINE float | Floor (float x) |
static MCORE_INLINE bool | IsPositive (float x) |
static MCORE_INLINE bool | IsNegative (float x) |
static MCORE_INLINE bool | IsFloatZero (float x) |
static MCORE_INLINE bool | IsFloatEqual (float x, float y) |
static MCORE_INLINE float | SignOfFloat (float x) |
static MCORE_INLINE float | Abs (float x) |
static MCORE_INLINE float | Ceil (float x) |
static MCORE_INLINE float | RadiansToDegrees (float rad) |
static MCORE_INLINE float | DegreesToRadians (float deg) |
static MCORE_INLINE float | Sin (float x) |
static MCORE_INLINE float | Cos (float x) |
static MCORE_INLINE float | Tan (float x) |
static MCORE_INLINE float | ASin (float x) |
static MCORE_INLINE float | ACos (float x) |
static MCORE_INLINE float | ATan (float x) |
static MCORE_INLINE float | ATan2 (float y, float x) |
static MCORE_INLINE float | SignOfCos (float y) |
static MCORE_INLINE float | SignOfSin (float y) |
static MCORE_INLINE float | Exp (float x) |
static MCORE_INLINE float | Log (float x) |
static MCORE_INLINE float | Log2 (float x) |
static MCORE_INLINE float | Pow (float base, float exponent) |
static MCORE_INLINE float | Sqrt (float x) |
static MCORE_INLINE float | SafeSqrt (float x) |
static MCORE_INLINE float | FastSqrt (float x) |
static MCORE_INLINE float | FastSqrt2 (float x) |
static MCORE_INLINE float | InvSqrt (float x) |
static MCORE_INLINE float | FastInvSqrt (float x) |
static MCORE_INLINE uint32 | NextPowerOfTwo (uint32 x) |
static MCORE_INLINE float | FMod (float x, float y) |
static MCORE_INLINE float | SafeFMod (float x, float y) |
template<typename T > | |
static MCORE_INLINE T | Align (T inValue, T alignment) |
static MCORE_INLINE void | MulSign (float &dest, float const &source) |
Static Public Attributes | |
static const float | pi |
static const float | twoPi |
static const float | halfPi |
static const float | invPi |
static const float | epsilon |
static const float | sqrtHalf |
static const float | sqrt2 |
static const float | sqrt3 |
static const float | halfSqrt2 |
static const float | halfSqrt3 |
The math class. All methods and attributes are static.
|
static |
Calculates the absolute value. The Abs function returns the absolute value of its parameter. Examples: The absolute value of -4 is 4 The absolute value of -41567 is 41567 The absolute value of -3.141593 is 3.141593
x | The value to calculate the absolute value from. |
|
static |
Arccosine function.
x | Angle in radians. |
|
static |
Align a given size_t value to a given alignment. For example when the input value of inOutValue contains a value of 50, and the alignment is set to 16, then the aligned return value would be 64.
inValue | The input value, which would be 50 in our above example. |
alignment | The alignment touse, which would be 16 in our above example. |
|
static |
Arcsine function.
x | Angle in radians. |
|
static |
Arctangent function.
x | Angle in radians. |
|
static |
Calculate the arctangent of y/x.
y | The value of y. |
x | The value of x. |
|
static |
Calculates the ceiling of a value. The ceil function returns a value representing the smallest integer that is greater than or equal to x. Examples: The ceil of 2.8 is 3.000000 The ceil of -2.8 is -2.000000
x | The value to ceil. |
|
static |
Cosine function.
x | Angle in radians. |
|
static |
Degree to radians Conversion.
deg | The angle (degrees) to convert. |
|
static |
Calculates the exponential.
x | The value. |
|
static |
Calculates a fast approximation (very good approx) to 1/sqrt(x). This one is more accurate than FastInvSqrt2, but a bit slower, but still much faster than the standard 1.0f / sqrt(x).
x | The value in the equation 1/sqrt(x). |
|
static |
Fast square root. On the PC and MSVC compiler an optimized SSE version is used. On other platforms or other compilers it uses the standard square root. The precision is 22 bits here.
|
static |
Fast square root method 2. On the PC and MSVC compiler an optimized SSE version is used. On other platforms or other compilers it uses the standard square root. The precision is 11 bits here.
|
static |
Calculates the floored version of a value. The floor function returns a value representing the largest integer that is less than or equal to x. Examples: The floor of 2.8 is 2.000000 The floor of -2.8 is -3.000000
x | The value to floor. |
|
static |
Perform the modulus calculation on a float. Please keep in mind that the value of y is not allowed to be zero. If you don't know if y will be zero, use SafeFMod instead.
x | The value to take the modulus on. |
y | The modulus value, which is NOT allowed to be zero. |
|
static |
Calculates the inverse square root (1 / Sqrt(x)). Parameter has to be nonnegative.
x | Nonnegative value. |
|
static |
Tests if two numbers are equal to each other. This uses the epsilon value as tolerance. Basically it does "return (Abs(x-y) < epsilon)".
x | The first value. |
y | The second value. |
|
static |
Tests if a number is equal to zero. This uses the epsilon value as tolerance. Basically it does "return (Abs(x) < epsilon)".
x | The tested value. |
|
static |
Tests if a number is negative.
x | The tested value. |
|
static |
Tests if a number is positive.
x | The tested value. |
|
static |
Calculates logarithms. The log functions return the logarithm of x. If x is negative, these functions return an indefinite, by default. If x is 0, they return INF (infinite).
x | The value. |
|
static |
Calculates logarithms. The log2 functions return the logarithm of x. If x is negative, these functions return an indefinite, by default. If x is 0, they return INF (infinite).
x | The value. |
|
static |
Multiply a float value by its sign. This basically does:
dest = source > 0.0f ? source : -source; or dest = source * sgn(source);
Using bit operations the required if statement is eliminated.
|
static |
Calculates a fast (but less accurate) approximation to 1/sqrt(x). The precision starts to show changes after the second digit in most cases.
x | The value in the equation 1/sqrt(x). |
x | The value in the equation 1/sqrt(x). |
x | The value. |
|
static |
Calculates x raised to the power of y.
base | The base. |
exponent | The exponent. |
|
static |
Radians to degree Conversion.
rad | The angle(rads) to convert. |
|
static |
Perform the modulus calculation on a float. The value of y is allowed to be zero. If you know that the value of y will never be zero, please use FMod instead, as that is a bit faster.
x | The value to take the modulus on. |
y | The modulus value, which is allowed to be zero as well. |
|
static |
Calculates the square root. Parameter has to be nonnegative. The difference between Sqrt and SafeSqrt is that SafeSqrt checks if the parameter value is bigger than epsilon or not, otherwise it returns zero.
x | Nonnegative value. |
|
static |
Returns the sign of the cosine of the argument.
|
static |
Returns the sign of a real number.
x | The tested number. |
|
static |
Returns the sign of the sine of the argument.
|
static |
Sine function.
x | Angle in radians. |
|
static |
Calculates the square root. Parameter has to be nonnegative and non-zero.
x | Nonnegative value. |
|
static |
Tangent function.
x | Angle in radians. |
|
static |
A very small number, almost equal to zero (0.000001).
|
static |
PI divided by two
|
static |
Half the square root of two.
|
static |
Half the square root of three.
|
static |
1.0 divided by PI
|
static |
Check if a given float is positive.
f | The float to check. |
f | The float to check. |
|
static |
The square root of 2.
|
static |
The square root of 3.
|
static |
The square root of 0.5.
|
static |
PI multiplied by two