REDMath.h
Macro Definitions
Namespaces
Functions
typename T |
|
typename T |
|
typename T |
|
double |
|
|
|
|
|
unsigned short |
|
double |
|
double |
|
int |
|
int |
|
double |
Detailed Description
This file contains implementations of frequently used mathematic functions like min/max, conversions between math types…
Macro Definition
-
RED_HALF_ONE
Unsigned short value encoding 1.0f.
-
RED_HALF_MINUS_ONE
Unsigned short value encoding -1.0f.
Function Documentation
-
template<typename T>
inline const T &REDMin(const T &a, const T &b) Gets the minimum value of two values.
The values class must implement the ‘<’ operator.
- Parameters
a – first value to compare.
b – second value to compare.
- Returns
the minimum of the two values.
-
template<typename T>
inline const T &REDMax(const T &a, const T &b) Gets the maximum value of two values.
The values class must implement the ‘<’ operator.
- Parameters
a – first value to compare.
b – second value to compare.
- Returns
the maximum of the two values.
-
template<typename T>
inline const T &REDClamp(const T &a, const T &min, const T &max) Clamps the value two external boundaries.
If a is lower than min, then the function returns min. If a is higher than max, then the function returns max. If a is between min and max, then the function returns a.
The values class must implement the ‘<’ operator.
- Parameters
a – first value to compare.
min – minimum value of the range.
max – maximum value of the range.
- Returns
the maximum of the two values.
-
inline double REDLerp(double t, double a, double b)
Returns the linear interpolation at ‘t’ between two given values.
- Parameters
t – a value in [0, 1].
a – first value.
b – second value.
Warning
doxygenfunction: Unable to resolve function “REDHalfToFloat” with arguments “None”. Candidate function could not be parsed. Parsing error is Error when parsing function declaration. If the function has no return type: Error in declarator or parameters-and-qualifiers Invalid C++ declaration: Expecting “(” in parameters-and-qualifiers. [error at 7] REDExp float REDHalfToFloat (unsigned short iHalfFloat) ——-^ If the function has a return type: Error in declarator or parameters-and-qualifiers If pointer to member declarator: Invalid C++ declaration: Expected identifier in nested name, got keyword: float [error at 12] REDExp float REDHalfToFloat (unsigned short iHalfFloat) ————^ If declarator-id: Invalid C++ declaration: Expected identifier in nested name, got keyword: float [error at 12] REDExp float REDHalfToFloat (unsigned short iHalfFloat) ————^
Warning
doxygenfunction: Unable to resolve function “REDFloatToHalf” with arguments “None”. Candidate function could not be parsed. Parsing error is Error when parsing function declaration. If the function has no return type: Error in declarator or parameters-and-qualifiers Invalid C++ declaration: Expecting “(” in parameters-and-qualifiers. [error at 7] REDExp unsigned short REDFloatToHalf (float iFloat) ——-^ If the function has a return type: Error in declarator or parameters-and-qualifiers If pointer to member declarator: Invalid C++ declaration: Expected identifier in nested name, got keyword: unsigned [error at 15] REDExp unsigned short REDFloatToHalf (float iFloat) —————^ If declarator-id: Invalid C++ declaration: Expected identifier in nested name, got keyword: unsigned [error at 15] REDExp unsigned short REDFloatToHalf (float iFloat) —————^
-
inline unsigned short REDDoubleToHalf(double iDouble)
Converts a value from double to half-float format.
- Parameters
iDouble – value in double format (64 bits).
- Returns
the value converted to half-float format.
-
inline double REDLog2(double iValue)
Computes the base-2 logarithm of a value.
- Parameters
iValue – input value.
- Returns
the base-2 logarithm of a value.
-
inline double REDFract(double iValue)
Computes the fractional part of a value.
- Parameters
iValue – input value.
- Returns
the fractional part of a value.
-
inline int REDPositiveMod(int iValue, int iModulo)
Computes the positive modulo of a value.
- Parameters
iValue – input value.
iModulo – modulo value.
- Returns
the positive modulo of a value.
-
inline int REDFastFloor(double iValue)
Computes the floor of a value.
- Parameters
iValue – input value.
- Returns
the floor of a value.
-
inline double REDMISPower(double pdf_a, double pdf_b)