"L. Spiro Engine"
|
The base for our math functions. More...
#include <LSMMathLib.h>
Classes | |
union | LSM_FLINT |
Static Public Member Functions | |
static LSVOID LSE_FCALL | Init () |
static LSREAL LSE_FCALL | InvSqrt (LSREAL _fX) |
static LSREAL LSE_FCALL | Sqrt (LSREAL _fX) |
static LSREAL LSE_FCALL | Sin (LSREAL _fX) |
static LSREAL LSE_FCALL | Cos (LSREAL _fX) |
static LSVOID LSE_FCALL | SinCos (LSREAL _fA, LSREAL &_fSine, LSREAL &_fCosine) |
static LSREAL LSE_FCALL | Tan (LSREAL _fX) |
static LSREAL LSE_FCALL | ASin (LSREAL _fX) |
static LSREAL LSE_FCALL | ACos (LSREAL _fX) |
static LSREAL LSE_FCALL | ATan (LSREAL _fX) |
static LSREAL LSE_FCALL | ATan (LSREAL _fY, LSREAL _fX) |
static LSREAL LSE_FCALL | Pow (LSREAL _fX, LSREAL _fY) |
static LSREAL LSE_FCALL | Exp (LSREAL _fX) |
static LSREAL LSE_FCALL | Log (LSREAL _fX, LSREAL _fY) |
static LSREAL LSE_FCALL | Abs (LSREAL _fX) |
template<typename _tType > | |
static _tType LSE_FCALL | AbsT (_tType _fX) |
static LSBOOL LSE_FCALL | SameSign (LSREAL _fLeft, LSREAL _fRight) |
static LSREAL LSE_FCALL | FMod (LSREAL _fX, LSREAL _fMod) |
static LSREAL LSE_FCALL | Floor (LSREAL _fX) |
static LSREAL LSE_FCALL | Ceil (LSREAL _fX) |
template<typename _tType > | |
static _tType LSE_FCALL | Max (_tType _fX, _tType _fY) |
template<typename _tType > | |
static _tType LSE_FCALL | Min (_tType _fX, _tType _fY) |
template<typename _tType > | |
static LSVOID LSE_FCALL | Swap (LSE_UNALIGNED _tType &_fLeft, LSE_UNALIGNED _tType &_fRight) |
template<typename _tType > | |
static _tType LSE_FCALL | Clamp (_tType _fValue, _tType _fLow, _tType _fHigh) |
static LSBOOL LSE_FCALL | Equals (LSREAL _fX, LSREAL _fY, LSREAL _fEpsilon) |
template<typename _tType > | |
static LSBOOL LSE_FCALL | EqualsT (_tType _fX, _tType _fY, _tType _fEpsilon) |
Static Protected Attributes | |
static LSBOOL | m_bInitialized |
The base for our math functions.
Class CMathLib Description: The base for our math functions. This must be included when you want to use these math functions. This library allows using a macro (LSM_PERFORMANCE) to change its performance in terms of speed/accuracy. It also allows defining the base type used in all the structures/math (LSM_BASETYPE).
Note that if LSM_PERFORMANCE <= 0 the size of the CVector3 class will change from 3 LSREALs to 4 LSREALs.
Aside from defining the base real type (LSREAL) it also defines a high-precision type (LSREALHP) for use when extra precision is required. Use this only when speed is not a concern. In the special cases where LSREALHP is used, it is also acceptable to use the LSM*HP math macros (LSMCOSHP, LSMSQRTHP, etc.) Always use LSREAL_TO_HP() and HP_TO_LSREAL() to cast between regular- and high- precision values!
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Abs | ( | LSREAL | _fX | ) | [static] |
Absolute value of _fX.
_tType LSE_FCALL lsm::CMathLib::AbsT | ( | _tType | _fX | ) | [static] |
Absolute value of _fX.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::ACos | ( | LSREAL | _fX | ) | [static] |
Arc cosine.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::ASin | ( | LSREAL | _fX | ) | [static] |
Arc sine.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::ATan | ( | LSREAL | _fX | ) | [static] |
Arc tangent.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::ATan | ( | LSREAL | _fY, |
LSREAL | _fX | ||
) | [static] |
Arc tangent.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Ceil | ( | LSREAL | _fX | ) | [static] |
Nearest integer upwards.
_fX | The value to round upwards. |
_tType LSE_FCALL lsm::CMathLib::Clamp | ( | _tType | _fValue, |
_tType | _fLow, | ||
_tType | _fHigh | ||
) | [static] |
Clamp a value between two others.
_fValue | The value to be clamped. |
_fLow | Lower limit for the value to clamp, inclusive. |
_fHigh | Upper limit for the value to clamp, inclusive. |
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Cos | ( | LSREAL | _fX | ) | [static] |
Cosine.
LSE_INLINE LSBOOL LSE_FCALL lsm::CMathLib::Equals | ( | LSREAL | _fX, |
LSREAL | _fY, | ||
LSREAL | _fEpsilon | ||
) | [static] |
Compare values for equality using an epsilon factor.
_fX | The left value to compare using epsilon. |
_fY | The right value to compare using epsilon. |
_fEpsilon | The epsilon to use for the comparison. |
LSBOOL LSE_FCALL lsm::CMathLib::EqualsT | ( | _tType | _fX, |
_tType | _fY, | ||
_tType | _fEpsilon | ||
) | [static] |
Compare values for equality using an epsilon factor.
_fX | The left value to compare using epsilon. |
_fY | The right value to compare using epsilon. |
_fEpsilon | The epsilon to use for the comparison. |
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Exp | ( | LSREAL | _fX | ) | [static] |
E raised to the power of _fX.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Floor | ( | LSREAL | _fX | ) | [static] |
Nearest integer.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::FMod | ( | LSREAL | _fX, |
LSREAL | _fMod | ||
) | [static] |
Floating-point modulus.
static LSVOID LSE_FCALL lsm::CMathLib::Init | ( | ) | [static] |
Initializes the math library. Can be called only once. Multiple calls have no effect. The math library cannot be used until this is called.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::InvSqrt | ( | LSREAL | _fX | ) | [static] |
Inverse square root.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Log | ( | LSREAL | _fX, |
LSREAL | _fY | ||
) | [static] |
LOGy( X ). Determines by what exponent _fX was raised to get _fY result.
_fX | The base. |
_fY | The result. |
_tType LSE_FCALL lsm::CMathLib::Max | ( | _tType | _fX, |
_tType | _fY | ||
) | [static] |
Max between two numbers.
_tType LSE_FCALL lsm::CMathLib::Min | ( | _tType | _fX, |
_tType | _fY | ||
) | [static] |
Min between two numbers.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Pow | ( | LSREAL | _fX, |
LSREAL | _fY | ||
) | [static] |
_fX raised to the power of fY.
LSE_INLINE LSBOOL LSE_FCALL lsm::CMathLib::SameSign | ( | LSREAL | _fLeft, |
LSREAL | _fRight | ||
) | [static] |
Test two numbers for having the same sign.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Sin | ( | LSREAL | _fX | ) | [static] |
Sine.
LSE_INLINE LSVOID LSE_FCALL lsm::CMathLib::SinCos | ( | LSREAL | _fA, |
LSREAL & | _fSine, | ||
LSREAL & | _fCosine | ||
) | [static] |
Sine and cosine at once. Fast on the Win32 platform.
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Sqrt | ( | LSREAL | _fX | ) | [static] |
Square root.
LSVOID LSE_FCALL lsm::CMathLib::Swap | ( | LSE_UNALIGNED _tType & | _fLeft, |
LSE_UNALIGNED _tType & | _fRight | ||
) | [static] |
Swap two numbers.
_fLeft | The left operand. |
_fRight | The right operand. |
LSE_INLINE LSREAL LSE_FCALL lsm::CMathLib::Tan | ( | LSREAL | _fX | ) | [static] |
Tangent.
LSBOOL lsm::CMathLib::m_bInitialized [static, protected] |
Are we initialized?