Common mathematical functions.
![]() | Common mathematical functions. |
#define DOT2 | Computes the dot product of two 2D vectors, the elements are accessed using array notation. |
#define DOT3 | Computes the dot product of two 3D vectors, the elements are accessed using array notation. |
#define ABSDOT3 | Computes the dot product of two 3D vectors, but takes the absolute value of each element before summation. |
#define DOT3_xyz | Computes the dot product of a float3 and another vector given by three floats. |
#define DOT3STRIDED | Computes the dot product of two 3D vectors, but with the elements of the second vector being scattered noncontiguous in memory. |
#define DOT4 | Computes the dot product of two 4D vectors, the elements are accessed using array notation. |
#define DOT4STRIDED | Computes the dot product of two 4D vectors, but with the elements of the second vector being scattered noncontiguous in memory. |
#define DOT4POS | Computes the dot product of a 4D vector and a 3D position vector (w == 1). |
#define DOT4POS_xyz | Computes the dot product of a 4D vector and a position vector (x,y,z,1). |
#define DOT4DIR | Computes the dot product of a 4D vector and a direction vector (x,y,z,0). |
#define DOT4DIR_xyz | Computes the dot product of a 4D vector and a direction vector (x,y,z,0). |
#define MATH_SKIP_WORD | |
#define MATH_NEXT_WORD_IS | |
![]() | Converts the given amount of degrees into radians. |
![]() | Converts the given amount of radians into degrees. |
![]() | Computes the function sin(x). |
![]() | Computes the function cos(x). |
![]() | Computes the function tan(x). |
![]() | Simultaneously computes both sin(x) and cos(x), which yields a small performance increase over to computing them separately. |
![]() | Computes sin and cos of the .x and .y components of angleRadians, stored to the corresponding components of outSin and outCos. |
![]() | Computes sin and cos of the .x, .y and .z components of angleRadians, stored to the corresponding components of outSin and outCos. |
![]() | Computes sin and cos of the four components of angleRadians, stored to the corresponding components of outSin and outCos. |
![]() | Computes the function arcsin(x), in radians. |
![]() | Computes the function arccos(x), in radians. |
![]() | Computes the function arctan(x), in radians. |
![]() | Computes the signed (principal value) arc-tangent of y/x, in radians. |
![]() | Computes the hyperbolic sine of x. |
![]() | Computes the hyperbolic cosine of x. |
![]() | Computes the hyperbolic tangent of x. |
![]() | Returns true if the given number is a power of 2. |
![]() | Returns the smallest power-of-2 number (1,2,4,8,16,32,...) greater or equal than the given number. |
![]() | Returns the largest power-of-2 number (1,2,4,8,16,32,...) smaller or equal than the given number. |
![]() | Returns the given number rounded up to the next multiple of n. |
![]() | Raises the given base to an integral exponent. |
![]() | Raises the given base to a float exponent. |
![]() | Returns e (the constant 2.71828...) raised to the given power. |
![]() | Computes a logarithm of the given value in the specified base. |
![]() | Computes a logarithm in base-2. |
![]() | Computes a logarithm in the natural base (using e=2.71828... as the base) |
![]() | Computes a logarithm in base-10. |
![]() | Returns f rounded up to the next integer, as float. |
![]() | Returns f rounded up to the next integer, as integer. |
![]() | Returns f rounded down to the previous integer, as float. |
![]() | Returns f rounded down to the previous integer, as integer. |
![]() | Returns f rounded to the nearest integer, as float. |
![]() | Returns f rounded to the nearest integer, as integer. |
![]() | Returns -1 or 1 depending on the sign of f. |
![]() | Returns 0 if f is zero up to the given epsilon. Otherwise returns -1 or 1 depending on the sign of f. |
![]() | Linearly interpolates between a and b. |
![]() | Linearly interpolates from a to b, under the modulus mod. |
![]() | Computes the lerp factor a and b have to be Lerp()ed to get x. |
![]() | See http://msdn.microsoft.com/en-us/library/bb509665(v=VS.85).aspx. |
![]() | See http://msdn.microsoft.com/en-us/library/bb509658(v=vs.85).aspx. |
![]() | Limits x to the range [0, mod], but instead of wrapping around from mod to 0, the result will move back from mod to 0 as x goes from mod to 2*mod. |
![]() | Computes a floating-point modulus. |
![]() | Computes a floating-point modulus, but restricts the output to the range [0, mod[. |
![]() | Returns the fractional part of x. |
![]() | Returns the square root of x. |
![]() | Computes a fast approximation of the square root of x. |
![]() | Returns 1/Sqrt(x). (The reciprocal of the square root of x) |
![]() | SSE implementation of reciprocal square root. |
![]() | Returns 1/x, the reciprocal of x. |
![]() | Returns 1/x, the reciprocal of x, using a fast approximation (SSE rcp instruction). |
![]() | Calculates n! at runtime. Use class FactorialT<N> to evaluate factorials at compile-time. |
![]() | Calculates (N nCr K) at runtime with recursion, running time is exponential to n. |
![]() | Calculates (N nCr K) at runtime, running time is proportional to n*k. |
![]() | Clamps the given input value to the range [min, max]. |
![]() | Clamps the given input value to the range [0, 1]. |
![]() | Computes the smaller of two values. |
![]() | Computes the larger of two values. |
![]() | Computes the smallest of three values. |
![]() | Computes the largest of three values. |
![]() | Computes the smallest of four values. |
![]() | Computes the largest of four values. |
![]() | Swaps the two values. |
![]() | Returns true if a > b. |
![]() | Returns true if a < b. |
![]() | Returns the absolute value of a. |
![]() | Returns true if a and b are equal, using operator ==(). |
![]() | Compares the two values for equality, allowing the given amount of absolute error. |
![]() | Computes the relative error of the two variables. |
![]() | Compares the two values for equality, allowing the given amount of relative error. |
![]() | Compares two floats interpreted as integers, see http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm Warning: This comparison is not safe with NANs or INFs. |
![]() | Returns true if the given value is not an inf or a nan. |
![]() | |
![]() | |
![]() | Returns true if the given value is a not-a-number. |
![]() | Returns true if the given value is +inf or -inf. |
![]() | |
![]() | |
![]() | |
![]() | Serializes a float to a string. |
![]() | Deserializes a float from the given string. |
![]() | Deserializes a double from the given string. |