orx 1.16
Portable Game Engine
Loading...
Searching...
No Matches
OrxMath

Macros

#define orxCLAMP(V, MIN, MAX)
#define orxF2S(V)
#define orxF2U(V)
#define orxLERP(A, B, T)
#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_MAX   orx2F(3.402823466e+38F)
#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 orxMATH_KF_TINY_EPSILON   orx2F(1.0e-037f)
#define orxMAX(A, B)
#define orxMIN(A, B)
#define orxREMAP(A1, B1, A2, B2, V)
#define orxS2F(V)
#define orxU2F(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 orxS64 orxFASTCALL orxMath_GetRandomS64 (orxS64 _s64Min, orxS64 _s64Max)
orxDLLAPI void orxFASTCALL orxMath_GetRandomSeeds (orxU32 _au32Seeds[4])
orxDLLAPI orxU32 orxFASTCALL orxMath_GetRandomU32 (orxU32 _u32Min, orxU32 _u32Max)
orxDLLAPI orxU64 orxFASTCALL orxMath_GetRandomU64 (orxU64 _u64Min, orxU64 _u64Max)
orxDLLAPI orxFLOAT orxFASTCALL orxMath_GetSteppedRandomFloat (orxFLOAT _fMin, orxFLOAT _fMax, orxFLOAT _fStep)
orxDLLAPI orxS32 orxFASTCALL orxMath_GetSteppedRandomS32 (orxS32 _s32Min, orxS32 _s32Max, orxS32 _s32Step)
orxDLLAPI orxS64 orxFASTCALL orxMath_GetSteppedRandomS64 (orxS64 _s64Min, orxS64 _s64Max, orxS64 _s64Step)
orxDLLAPI orxU32 orxFASTCALL orxMath_GetSteppedRandomU32 (orxU32 _u32Min, orxU32 _u32Max, orxU32 _u32Step)
orxDLLAPI orxU64 orxFASTCALL orxMath_GetSteppedRandomU64 (orxU64 _u64Min, orxU64 _u64Max, orxU64 _u64Step)
static orxINLINE orxU32 orxMath_GetTrailingZeroCount (orxU32 _u32Value)
static orxINLINE orxU32 orxMath_GetTrailingZeroCount64 (orxU64 _u64Value)
orxDLLAPI void orxFASTCALL orxMath_InitRandom (orxU32 _u32Seed)
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)
orxDLLAPI void orxFASTCALL orxMath_SetRandomSeeds (const orxU32 _au32Seeds[4])
static orxINLINE orxFLOAT orxMath_Sin (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_SmootherStep (orxFLOAT _fMin, orxFLOAT _fMax, orxFLOAT _fValue)
static orxINLINE orxFLOAT orxMath_SmoothStep (orxFLOAT _fMin, orxFLOAT _fMax, orxFLOAT _fValue)
static orxINLINE orxFLOAT orxMath_Sqrt (orxFLOAT _fOp)
static orxINLINE orxFLOAT orxMath_Tan (orxFLOAT _fOp)

Detailed Description

Math module Contains all base math functions

Macro Definition Documentation

◆ orxCLAMP

#define orxCLAMP ( V,
MIN,
MAX )
Value:
orxMAX(orxMIN(V, MAX), MIN)
#define orxMIN(A, B)
Definition orxMath.h:83
#define orxMAX(A, B)
Definition orxMath.h:90

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 98 of file orxMath.h.

◆ orxF2S

#define orxF2S ( V)
Value:
((orxS32) (V))

Converts an orxFLOAT to an orxS32

Parameters
[in]VValue to convert
Returns
Converted value

Definition at line 110 of file orxMath.h.

◆ orxF2U

#define orxF2U ( V)
Value:
((orxU32) (V))

Converts an orxFLOAT to an orxU32

Parameters
[in]VValue to convert
Returns
Converted value

Definition at line 104 of file orxMath.h.

◆ orxLERP

#define orxLERP ( A,
B,
T )
Value:
((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 66 of file orxMath.h.

◆ orxMATH_KF_2_PI

#define orxMATH_KF_2_PI   orx2F(6.283185307f)

2 PI constant

Definition at line 401 of file orxMath.h.

◆ orxMATH_KF_DEG_TO_RAD

#define orxMATH_KF_DEG_TO_RAD   orx2F(3.141592654f / 180.0f)

Degree to radian conversion constant

Definition at line 405 of file orxMath.h.

◆ orxMATH_KF_EPSILON

#define orxMATH_KF_EPSILON   orx2F(0.0001f)

Epsilon constant

Definition at line 398 of file orxMath.h.

◆ orxMATH_KF_MAX

#define orxMATH_KF_MAX   orx2F(3.402823466e+38F)

Max constant

Definition at line 400 of file orxMath.h.

◆ orxMATH_KF_PI

#define orxMATH_KF_PI   orx2F(3.141592654f)

PI constant

Definition at line 402 of file orxMath.h.

◆ orxMATH_KF_PI_BY_2

#define orxMATH_KF_PI_BY_2   orx2F(1.570796327f)

PI / 2 constant

Definition at line 403 of file orxMath.h.

◆ orxMATH_KF_PI_BY_4

#define orxMATH_KF_PI_BY_4   orx2F(0.785398163f)

PI / 4 constant

Definition at line 404 of file orxMath.h.

◆ orxMATH_KF_RAD_TO_DEG

#define orxMATH_KF_RAD_TO_DEG   orx2F(180.0f / 3.141592654f)

Radian to degree conversion constant

Definition at line 406 of file orxMath.h.

◆ orxMATH_KF_SQRT_2

#define orxMATH_KF_SQRT_2   orx2F(1.414213562f)

Sqrt(2) constant

Definition at line 397 of file orxMath.h.

◆ orxMATH_KF_TINY_EPSILON

#define orxMATH_KF_TINY_EPSILON   orx2F(1.0e-037f)

Tiny epsilon

Definition at line 399 of file orxMath.h.

◆ orxMAX

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

Gets maximum between two values

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

Definition at line 90 of file orxMath.h.

◆ orxMIN

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

Gets minimum between two values

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

Definition at line 83 of file orxMath.h.

◆ orxREMAP

#define orxREMAP ( A1,
B1,
A2,
B2,
V )
Value:
(((V) - (A1)) / ((B1) - (A1)) * ((B2) - (A2)) + (A2))

Remaps a value from one interval to another one

Parameters
[in]A1First interval's low boundary
[in]B1First interval's high boundary
[in]A2Second interval's low boundary
[in]B2Second interval's high boundary
[in]VValue to remap from the first interval to the second one
Returns
Remaped value

Definition at line 76 of file orxMath.h.

◆ orxS2F

#define orxS2F ( V)
Value:
((orxFLOAT)(V))

Converts an orxS32 to an orxFLOAT

Parameters
[in]VValue to convert
Returns
Converted value

Definition at line 122 of file orxMath.h.

◆ orxU2F

#define orxU2F ( V)
Value:
((orxFLOAT)(V))

Converts an orxU32 to an orxFLOAT

Parameters
[in]VValue to convert
Returns
Converted value

Definition at line 116 of file orxMath.h.

Function Documentation

◆ orxMath_Abs()

orxINLINE orxFLOAT orxMath_Abs ( orxFLOAT _fOp)
static

Gets an absolute value

Parameters
[in]_fOpInput value
Returns
Absolute value

Definition at line 610 of file orxMath.h.

◆ orxMath_ACos()

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 460 of file orxMath.h.

◆ orxMath_ASin()

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 475 of file orxMath.h.

◆ orxMath_ATan()

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 491 of file orxMath.h.

◆ orxMath_Ceil()

orxINLINE orxFLOAT orxMath_Ceil ( orxFLOAT _fOp)
static

Gets a ceiled value

Parameters
[in]_fOpInput value
Returns
Ceiled value

Definition at line 539 of file orxMath.h.

◆ orxMath_Cos()

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 430 of file orxMath.h.

◆ orxMath_Floor()

orxINLINE orxFLOAT orxMath_Floor ( orxFLOAT _fOp)
static

Gets a floored value

Parameters
[in]_fOpInput value
Returns
Floored value

Definition at line 524 of file orxMath.h.

◆ orxMath_GetBitCount()

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 224 of file orxMath.h.

◆ orxMath_GetNextPowerOfTwo()

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 326 of file orxMath.h.

◆ orxMath_GetRandomFloat()

orxDLLAPI orxFLOAT orxFASTCALL orxMath_GetRandomFloat ( orxFLOAT _fMin,
orxFLOAT _fMax )
extern

Gets a random orxFLOAT value

Parameters
[in]_fMinMinimum boundary (inclusive)
[in]_fMaxMaximum boundary (exclusive)
Returns
Random value

◆ orxMath_GetRandomS32()

orxDLLAPI orxS32 orxFASTCALL orxMath_GetRandomS32 ( orxS32 _s32Min,
orxS32 _s32Max )
extern

Gets a random orxS32 value

Parameters
[in]_s32MinMinimum boundary (inclusive)
[in]_s32MaxMaximum boundary (inclusive)
Returns
Random value

◆ orxMath_GetRandomS64()

orxDLLAPI orxS64 orxFASTCALL orxMath_GetRandomS64 ( orxS64 _s64Min,
orxS64 _s64Max )
extern

Gets a random orxS64 value

Parameters
[in]_s64MinMinimum boundary (inclusive)
[in]_s64MaxMaximum boundary (inclusive)
Returns
Random value

◆ orxMath_GetRandomSeeds()

orxDLLAPI void orxFASTCALL orxMath_GetRandomSeeds ( orxU32 _au32Seeds[4])
extern

Gets the current random seeds

Parameters
[out]_au32SeedsCurrent seeds

◆ orxMath_GetRandomU32()

orxDLLAPI orxU32 orxFASTCALL orxMath_GetRandomU32 ( orxU32 _u32Min,
orxU32 _u32Max )
extern

Gets a random orxU32 value

Parameters
[in]_u32MinMinimum boundary (inclusive)
[in]_u32MaxMaximum boundary (inclusive)
Returns
Random value

◆ orxMath_GetRandomU64()

orxDLLAPI orxU64 orxFASTCALL orxMath_GetRandomU64 ( orxU64 _u64Min,
orxU64 _u64Max )
extern

Gets a random orxU64 value

Parameters
[in]_u64MinMinimum boundary (inclusive)
[in]_u64MaxMaximum boundary (inclusive)
Returns
Random value

◆ orxMath_GetSteppedRandomFloat()

orxDLLAPI orxFLOAT orxFASTCALL orxMath_GetSteppedRandomFloat ( orxFLOAT _fMin,
orxFLOAT _fMax,
orxFLOAT _fStep )
extern

Gets a random orxFLOAT value using step increments

Parameters
[in]_fMinMinimum boundary (inclusive)
[in]_fMaxMaximum boundary (inclusive)
[in]_fStepStep value, must be strictly positive
Returns
Random value

◆ orxMath_GetSteppedRandomS32()

orxDLLAPI orxS32 orxFASTCALL orxMath_GetSteppedRandomS32 ( orxS32 _s32Min,
orxS32 _s32Max,
orxS32 _s32Step )
extern

Gets a random S32 value using step increments

Parameters
[in]_s32MinMinimum boundary (inclusive)
[in]_s32MaxMaximum boundary (inclusive)
[in]_s32StepStep value, must be strictly positive
Returns
Random value

◆ orxMath_GetSteppedRandomS64()

orxDLLAPI orxS64 orxFASTCALL orxMath_GetSteppedRandomS64 ( orxS64 _s64Min,
orxS64 _s64Max,
orxS64 _s64Step )
extern

Gets a random S64 value using step increments

Parameters
[in]_s64MinMinimum boundary (inclusive)
[in]_s64MaxMaximum boundary (inclusive)
[in]_s64StepStep value, must be strictly positive
Returns
Random value

◆ orxMath_GetSteppedRandomU32()

orxDLLAPI orxU32 orxFASTCALL orxMath_GetSteppedRandomU32 ( orxU32 _u32Min,
orxU32 _u32Max,
orxU32 _u32Step )
extern

Gets a random U32 value using step increments

Parameters
[in]_u32MinMinimum boundary (inclusive)
[in]_u32MaxMaximum boundary (inclusive)
[in]_u32StepStep value, must be strictly positive
Returns
Random value

◆ orxMath_GetSteppedRandomU64()

orxDLLAPI orxU64 orxFASTCALL orxMath_GetSteppedRandomU64 ( orxU64 _u64Min,
orxU64 _u64Max,
orxU64 _u64Step )
extern

Gets a random U64 value using step increments

Parameters
[in]_u64MinMinimum boundary (inclusive)
[in]_u64MaxMaximum boundary (inclusive)
[in]_u64StepStep value, must be strictly positive
Returns
Random value

◆ orxMath_GetTrailingZeroCount()

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 248 of file orxMath.h.

◆ orxMath_GetTrailingZeroCount64()

orxINLINE orxU32 orxMath_GetTrailingZeroCount64 ( orxU64 _u64Value)
static

Gets the count of trailing zeros in an orxU64

Parameters
[in]_u64ValueValue to process
Returns
Number of trailing zeros

Definition at line 275 of file orxMath.h.

◆ orxMath_InitRandom()

orxDLLAPI void orxFASTCALL orxMath_InitRandom ( orxU32 _u32Seed)
extern

Inits the random seed

Parameters
[in]_u32SeedValue to use as seed for random number generation

◆ orxMath_IsPowerOfTwo()

orxINLINE orxBOOL orxMath_IsPowerOfTwo ( orxU32 _u32Value)
static

Is value a power of two?

Parameters
[in]_u32ValueValue to test
Returns
orxTRUE / orxFALSE

Definition at line 311 of file orxMath.h.

◆ orxMath_Mod()

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 579 of file orxMath.h.

◆ orxMath_Pow()

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 595 of file orxMath.h.

◆ orxMath_Round()

orxINLINE orxFLOAT orxMath_Round ( orxFLOAT _fOp)
static

Gets a rounded value

Parameters
[in]_fOpInput value
Returns
Rounded value

Definition at line 554 of file orxMath.h.

◆ orxMath_SetRandomSeeds()

orxDLLAPI void orxFASTCALL orxMath_SetRandomSeeds ( const orxU32 _au32Seeds[4])
extern

Sets (replaces) the current random seeds

Parameters
[in]_au32SeedsSeeds to set

◆ orxMath_Sin()

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 415 of file orxMath.h.

◆ orxMath_SmootherStep()

orxINLINE orxFLOAT orxMath_SmootherStep ( orxFLOAT _fMin,
orxFLOAT _fMax,
orxFLOAT _fValue )
static

Gets smoother stepped value between two extrema

Parameters
[in]_fMinMinimum value
[in]_fMaxMaximum value
[in]_fValueValue to process
Returns
0.0 if _fValue <= _fMin, 1.0 if _fValue >= _fMax, smooth(er)ed value between 0.0 & 1.0 otherwise

Definition at line 379 of file orxMath.h.

◆ orxMath_SmoothStep()

orxINLINE orxFLOAT orxMath_SmoothStep ( orxFLOAT _fMin,
orxFLOAT _fMax,
orxFLOAT _fValue )
static

Gets smooth stepped value between two extrema

Parameters
[in]_fMinMinimum value
[in]_fMaxMaximum value
[in]_fValueValue to process
Returns
0.0 if _fValue <= _fMin, 1.0 if _fValue >= _fMax, smoothed value between 0.0 & 1.0 otherwise

Definition at line 358 of file orxMath.h.

◆ orxMath_Sqrt()

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 509 of file orxMath.h.

◆ orxMath_Tan()

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 445 of file orxMath.h.


Generated for orx by doxygen 1.8.11