Defines | Functions

OrxMath

Defines

#define orxCIRCULAR_CLAMP_INC_MAX(V, MIN, MAX)
#define orxCIRCULAR_CLAMP_INC_MIN(V, MIN, MAX)
#define orxCLAMP(V, MIN, MAX)   orxMAX(orxMIN(V, MAX), MIN)
#define orxF2S(V)   ((orxS32) (V))
#define orxF2U(V)   ((orxU32) (V))
#define orxLERP(A, B, T)   ((A) + ((T) * ((B) - (A))))
#define orxMATH_KF_2_PI   orx2F(6.283185307f)
#define orxMATH_KF_DEG_TO_RAD   orx2F(3.141592654f / 180.0f)
#define orxMATH_KF_EPSILON   orx2F(0.0001f)
#define orxMATH_KF_PI   orx2F(3.141592654f)
#define orxMATH_KF_PI_BY_2   orx2F(1.570796327f)
#define orxMATH_KF_PI_BY_4   orx2F(0.785398163f)
#define orxMATH_KF_RAD_TO_DEG   orx2F(180.0f / 3.141592654f)
#define orxMATH_KF_SQRT_2   orx2F(1.414213562f)
#define orxMAX(A, B)   (((A) < (B)) ? (B) : (A))
#define orxMIN(A, B)   (((A) > (B)) ? (B) : (A))
#define orxS2F(V)   ((orxFLOAT)(V))
#define orxU2F(V)   ((orxFLOAT)(V))

Functions

static orxINLINE orxFLOAT orxMath_Abs (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_ACos (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_ASin (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_ATan (orxFLOAT _fOp1, orxFLOAT _fOp2)
static orxINLINE orxFLOAT orxMath_Ceil (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_Cos (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_Floor (orxFLOAT _fOp)
static orxINLINE orxU32 orxMath_GetBitCount (orxU32 _u32Value)
static orxINLINE orxU32 orxMath_GetNextPowerOfTwo (orxU32 _u32Value)
orxDLLAPI orxFLOAT orxFASTCALL orxMath_GetRandomFloat (orxFLOAT _fMin, orxFLOAT _fMax)
orxDLLAPI orxS32 orxFASTCALL orxMath_GetRandomS32 (orxS32 _s32Min, orxS32 _s32Max)
orxDLLAPI orxU32 orxFASTCALL orxMath_GetRandomU32 (orxU32 _u32Min, orxU32 _u32Max)
static orxINLINE orxU32 orxMath_GetTrailingZeroCount (orxU32 _u32Value)
orxDLLAPI void orxFASTCALL orxMath_InitRandom (orxS32 _s32Seed)
static orxINLINE orxBOOL orxMath_IsPowerOfTwo (orxU32 _u32Value)
static orxINLINE orxFLOAT orxMath_Mod (orxFLOAT _fOp1, orxFLOAT _fOp2)
static orxINLINE orxFLOAT orxMath_Pow (orxFLOAT _fOp, orxFLOAT _fExp)
static orxINLINE orxFLOAT orxMath_Round (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_Sin (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_Sqrt (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_Tan (orxFLOAT _fOp)

Detailed Description

Math module Contains all base math functions


Define Documentation

#define orxCIRCULAR_CLAMP_INC_MAX (   V,
  MIN,
  MAX 
)
Value:
do                                              \
{                                               \
  while((V) <= (MIN))                           \
  {                                             \
    (V) += ((MAX) - (MIN));                     \
  }                                             \
  while((V) > (MAX))                            \
  {                                             \
    (V) -= ((MAX) - (MIN));                     \
  }                                             \
} while(orxFALSE)

Gets circularly clamped (for ring spaces) value between two boundaries ]MIN, MAX]

Parameters:
[in]VValue to clamp
[in]MINMinimum boundary
[in]MAXMaximum boundary
Returns:
Circularly clamped value between MIN & MAX

Definition at line 113 of file orxMath.h.

#define orxCIRCULAR_CLAMP_INC_MIN (   V,
  MIN,
  MAX 
)
Value:
do                                              \
{                                               \
  while((V) < (MIN))                            \
  {                                             \
    (V) += ((MAX) - (MIN));                     \
  }                                             \
  while((V) >= (MAX))                           \
  {                                             \
    (V) -= ((MAX) - (MIN));                     \
  }                                             \
} while(orxFALSE)

Gets circularly clamped (for ring spaces) value between two boundaries [MIN, MAX[

Parameters:
[in]VValue to clamp
[in]MINMinimum boundary
[in]MAXMaximum boundary
Returns:
Circularly clamped value between MIN & MAX

Definition at line 94 of file orxMath.h.

#define orxCLAMP (   V,
  MIN,
  MAX 
)    orxMAX(orxMIN(V, MAX), MIN)

Gets clamped value between two boundaries

Parameters:
[in]VValue to clamp
[in]MINMinimum boundary
[in]MAXMaximum boundary
Returns:
Clamped value between MIN & MAX

Definition at line 86 of file orxMath.h.

#define orxF2S (   V )    ((orxS32) (V))

Converts an orxFLOAT to an orxS32

Parameters:
[in]VValue to convert
Returns:
Converted value

Definition at line 136 of file orxMath.h.

#define orxF2U (   V )    ((orxU32) (V))

Converts an orxFLOAT to an orxU32

Parameters:
[in]VValue to convert
Returns:
Converted value

Definition at line 130 of file orxMath.h.

#define orxLERP (   A,
  B,
 
)    ((A) + ((T) * ((B) - (A))))

Maths related includes Public macro Lerps between two values given a parameter T [0, 1]

Parameters:
[in]AFirst value (will be selected for T = 0)
[in]BSecond value (will be selected for T = 1)
[in]TLerp coefficient parameter [0, 1]
Returns:
Lerped value

Definition at line 63 of file orxMath.h.

#define orxMATH_KF_2_PI   orx2F(6.283185307f)

2 PI constant

Definition at line 263 of file orxMath.h.

#define orxMATH_KF_DEG_TO_RAD   orx2F(3.141592654f / 180.0f)

Degree to radian conversion constant

Definition at line 267 of file orxMath.h.

#define orxMATH_KF_EPSILON   orx2F(0.0001f)

Epsilon constant

Definition at line 262 of file orxMath.h.

#define orxMATH_KF_PI   orx2F(3.141592654f)

PI constant

Definition at line 264 of file orxMath.h.

#define orxMATH_KF_PI_BY_2   orx2F(1.570796327f)

PI / 2 constant

Definition at line 265 of file orxMath.h.

#define orxMATH_KF_PI_BY_4   orx2F(0.785398163f)

PI / 4 constant

Definition at line 266 of file orxMath.h.

#define orxMATH_KF_RAD_TO_DEG   orx2F(180.0f / 3.141592654f)

Radian to degree conversion constant

Definition at line 268 of file orxMath.h.

#define orxMATH_KF_SQRT_2   orx2F(1.414213562f)

Sqrt(2) constant

Definition at line 261 of file orxMath.h.

#define orxMAX (   A,
 
)    (((A) < (B)) ? (B) : (A))

Gets maximum between two values

Parameters:
[in]AFirst value
[in]BSecond value
Returns:
Maximum between A & B

Definition at line 78 of file orxMath.h.

#define orxMIN (   A,
 
)    (((A) > (B)) ? (B) : (A))

Gets minimum between two values

Parameters:
[in]AFirst value
[in]BSecond value
Returns:
Minimum between A & B

Definition at line 71 of file orxMath.h.

#define orxS2F (   V )    ((orxFLOAT)(V))

Converts an orxS32 to an orxFLOAT

Parameters:
[in]VValue to convert
Returns:
Converted value

Definition at line 148 of file orxMath.h.

#define orxU2F (   V )    ((orxFLOAT)(V))

Converts an orxU32 to an orxFLOAT

Parameters:
[in]VValue to convert
Returns:
Converted value

Definition at line 142 of file orxMath.h.


Function Documentation

static orxINLINE orxFLOAT orxMath_Abs ( orxFLOAT  _fOp ) [static]

Gets an absolute value

Parameters:
[in]_fOpInput value
Returns:
Absolute value

Definition at line 535 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_ACos ( orxFLOAT  _fOp ) [static]

Gets an arccosine

Parameters:
[in]_fOpInput radian angle value
Returns:
Arccosine of the given angle

Definition at line 349 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_ASin ( orxFLOAT  _fOp ) [static]

Gets an arcsine

Parameters:
[in]_fOpInput radian angle value
Returns:
Arcsine of the given angle

Definition at line 373 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_ATan ( orxFLOAT  _fOp1,
orxFLOAT  _fOp2 
) [static]

Gets an arctangent

Parameters:
[in]_fOp1First operand
[in]_fOp2Second operand
Returns:
Arctangent of the given angle

Definition at line 398 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Ceil ( orxFLOAT  _fOp ) [static]

Gets a ceiled value

Parameters:
[in]_fOpInput value
Returns:
Ceiled value

Definition at line 464 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Cos ( orxFLOAT  _fOp ) [static]

Gets a cosine

Parameters:
[in]_fOpInput radian angle value
Returns:
Cosine of the given angle

Definition at line 277 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Floor ( orxFLOAT  _fOp ) [static]

Gets a floored value

Parameters:
[in]_fOpInput value
Returns:
Floored value

Definition at line 440 of file orxMath.h.

static orxINLINE orxU32 orxMath_GetBitCount ( orxU32  _u32Value ) [static]

Gets the count of bit in an orxU32

Parameters:
[in]_u32ValueValue to process
Returns:
Number of bits that are set in the value

Definition at line 186 of file orxMath.h.

static orxINLINE orxU32 orxMath_GetNextPowerOfTwo ( orxU32  _u32Value ) [static]

Gets next power of two of an orxU32

Parameters:
[in]_u32ValueValue to process
Returns:
If _u32Value is already a power of two, returns it, otherwise the next power of two

Definition at line 232 of file orxMath.h.

orxDLLAPI orxFLOAT orxFASTCALL orxMath_GetRandomFloat ( orxFLOAT  _fMin,
orxFLOAT  _fMax 
)

Gets a random orxFLOAT value

Parameters:
[in]_fMinMinimum boundary (inclusive)
[in]_fMaxMaximum boundary (inclusive)
Returns:
Random value
orxDLLAPI orxS32 orxFASTCALL orxMath_GetRandomS32 ( orxS32  _s32Min,
orxS32  _s32Max 
)

Gets a random orxS32 value

Parameters:
[in]_s32MinMinimum boundary (inclusive)
[in]_s32MaxMaximum boundary (inclusive)
Returns:
Random value
orxDLLAPI orxU32 orxFASTCALL orxMath_GetRandomU32 ( orxU32  _u32Min,
orxU32  _u32Max 
)

Gets a random orxU32 value

Parameters:
[in]_u32MinMinimum boundary (inclusive)
[in]_u32MaxMaximum boundary (inclusive)
Returns:
Random value
static orxINLINE orxU32 orxMath_GetTrailingZeroCount ( orxU32  _u32Value ) [static]

Gets the count of trailing zeros in an orxU32

Parameters:
[in]_u32ValueValue to process
Returns:
Number of trailing zeros

Definition at line 200 of file orxMath.h.

orxDLLAPI void orxFASTCALL orxMath_InitRandom ( orxS32  _s32Seed )

Inits the random seed with an orxFLOAT

Parameters:
[in]_s32SeedValue to use as seed for random number generation
static orxINLINE orxBOOL orxMath_IsPowerOfTwo ( orxU32  _u32Value ) [static]

Is value a power of two?

Parameters:
[in]_u32ValueValue to test
Returns:
orxTRUE / orxFALSE

Definition at line 217 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Mod ( orxFLOAT  _fOp1,
orxFLOAT  _fOp2 
) [static]

Gets a modulo value

Parameters:
[in]_fOp1Input value
[in]_fOp2Modulo value
Returns:
Modulo value

Definition at line 504 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Pow ( orxFLOAT  _fOp,
orxFLOAT  _fExp 
) [static]

Gets a powed value

Parameters:
[in]_fOpInput value
[in]_fExpExponent value
Returns:
Powed value

Definition at line 520 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Round ( orxFLOAT  _fOp ) [static]

Gets a rounded value

Parameters:
[in]_fOpInput value
Returns:
Rounded value

Definition at line 479 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Sin ( orxFLOAT  _fOp ) [static]

Gets a sine

Parameters:
[in]_fOpInput radian angle value
Returns:
Sine of the given angle

Definition at line 301 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Sqrt ( orxFLOAT  _fOp ) [static]

Gets a square root

Parameters:
[in]_fOpInput value
Returns:
Square root of the given value

Definition at line 425 of file orxMath.h.

static orxINLINE orxFLOAT orxMath_Tan ( orxFLOAT  _fOp ) [static]

Gets a tangent

Parameters:
[in]_fOpInput radian angle value
Returns:
Tangent of the given angle

Definition at line 325 of file orxMath.h.


Generated for orx by doxygen 1.5.6