OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::MathlibC Class Reference

#include <OgreMathlibC.h>

Static Public Member Functions

static ArrayReal Abs4 (ArrayReal a)
 Returns the absolute values of each 4 floats. More...
 
static ArrayReal ACos4 (ArrayReal x)
 Returns the arccos of x. More...
 
static ArrayInt And (ArrayInt a, ArrayInt b)
 Returns the result of "a & b". More...
 
static ArrayMaskI And (ArrayMaskI a, ArrayInt b)
 
static ArrayMaskI And (ArrayInt a, ArrayMaskI b)
 
static ArrayMaskI And (ArrayMaskI a, ArrayMaskI b)
 
static ArrayInt AndNot (ArrayInt a, ArrayInt b)
 Returns the result of "a & ~b". More...
 
static ArrayMaskI AndNot (ArrayMaskI a, ArrayInt b)
 
static ArrayMaskI AndNot (ArrayInt a, ArrayMaskI b)
 
static ArrayMaskI AndNot (ArrayMaskI a, ArrayMaskI b)
 
static ArrayReal Cmov4 (ArrayReal arg1, ArrayReal arg2, ArrayMaskR mask)
 Branchless conditional move for 4 floating point values. More...
 
static ArrayReal CmovRobust (ArrayReal arg1, ArrayReal arg2, ArrayMaskR mask)
 Robust, branchless conditional move for a 128-bit value. More...
 
static ArrayInt CmovRobust (ArrayInt arg1, ArrayInt arg2, ArrayMaskI mask)
 
static Real ColapseMax (ArrayReal a)
 Returns the maximum value of all elements in a. More...
 
static Real ColapseMin (ArrayReal a)
 Returns the minimum value of all elements in a. More...
 
static ArrayMaskR CompareGreater (ArrayReal a, ArrayReal b)
 Returns the result of "a > b". More...
 
static ArrayMaskR CompareGreaterEqual (ArrayReal a, ArrayReal b)
 Returns the result of "a >= b". More...
 
static ArrayMaskR CompareLess (ArrayReal a, ArrayReal b)
 Returns the result of "a < b". More...
 
static ArrayMaskR CompareLessEqual (ArrayReal a, ArrayReal b)
 Returns the result of "a <= b". More...
 
static ArrayReal Cos4 (ArrayReal x)
 Returns the cosine of x. More...
 
static ArrayReal Inv4 (ArrayReal val)
 Returns the reciprocal of x. More...
 
static ArrayReal InvNonZero4 (ArrayReal val)
 Returns the reciprocal of x. More...
 
static ArrayReal InvSqrt4 (ArrayReal f)
 Returns the squared root of the reciprocal of x. More...
 
static ArrayReal InvSqrtNonZero4 (ArrayReal f)
 Returns the squared root of the reciprocal of x. More...
 
static ArrayMaskR isInfinity (ArrayReal a)
 Returns the result of "a == std::numeric_limits<float>::infinity()". More...
 
static ArrayReal Max (ArrayReal a, ArrayReal b)
 Returns the maximum value between a and b. More...
 
static ArrayReal Min (ArrayReal a, ArrayReal b)
 Returns the minimum value between a and b. More...
 
static ArrayReal Modf4 (ArrayReal x, ArrayReal &outIntegral)
 Break x into fractional and integral parts. More...
 
static ArrayInt Or (ArrayInt a, ArrayInt b)
 Returns the result of "a | b". More...
 
static ArrayMaskI Or (ArrayMaskI a, ArrayMaskI b)
 
static ArrayMaskI Or (ArrayMaskI a, ArrayInt b)
 
static ArrayMaskI Or (ArrayInt a, ArrayMaskI b)
 
static void Set (ArrayReal &dst, Real val, size_t index)
 
static ArrayReal SetAll (Real val)
 
static ArrayInt SetAll (uint32 val)
 
static ArrayReal Sin4 (ArrayReal x)
 Returns the sine of x. More...
 
static void SinCos4 (ArrayReal x, ArrayReal &outSin, ArrayReal &outCos)
 Calculates the cosine & sine of x. More...
 
static ArrayMaskI TestFlags4 (ArrayInt a, ArrayInt b)
 Test if "a AND b" will result in non-zero, returning 0xffffffff on those cases. More...
 
static ArrayMaskI TestFlags4 (ArrayMaskI a, ArrayInt b)
 
static ArrayMaskI TestFlags4 (ArrayInt a, ArrayMaskI b)
 

Static Public Attributes

static const ArrayReal fDeg2Rad
 
static const ArrayReal fEpsilon
 
static const ArrayReal FLOAT_MIN
 
static const ArrayReal fRad2Deg
 
static const ArrayReal fSqEpsilon
 
static const ArrayReal HALF
 
static const ArrayReal INFINITEA
 
static const ArrayReal MAX_NEG
 
static const ArrayReal MAX_POS
 
static const ArrayReal NEG_ONE
 
static const ArrayReal ONE
 
static const ArrayReal ONE_DIV_2PI
 
static const ArrayReal OneMinusEpsilon
 
static const ArrayReal PI
 
static const ArrayReal SIGN_MASK
 
static const ArrayReal THREE
 
static const ArrayReal TWO_PI
 

Member Function Documentation

◆ Abs4()

static ArrayReal Ogre::MathlibC::Abs4 ( ArrayReal  a)
inlinestatic

Returns the absolute values of each 4 floats.

Parameters
4floating point values
Returns
abs( a )

References Ogre::Math::Abs().

◆ ACos4()

static ArrayReal Ogre::MathlibC::ACos4 ( ArrayReal  x)
inlinestatic

Returns the arccos of x.

Parameters
x4 floating point values
Returns
arccos( x ) (packed as 4 floats)

◆ And() [1/4]

static ArrayInt Ogre::MathlibC::And ( ArrayInt  a,
ArrayInt  b 
)
inlinestatic

Returns the result of "a & b".

Returns
r[i] = a[i] & b[i];

◆ And() [2/4]

static ArrayMaskI Ogre::MathlibC::And ( ArrayMaskI  a,
ArrayInt  b 
)
inlinestatic

◆ And() [3/4]

static ArrayMaskI Ogre::MathlibC::And ( ArrayInt  a,
ArrayMaskI  b 
)
inlinestatic

◆ And() [4/4]

static ArrayMaskI Ogre::MathlibC::And ( ArrayMaskI  a,
ArrayMaskI  b 
)
inlinestatic

◆ AndNot() [1/4]

static ArrayInt Ogre::MathlibC::AndNot ( ArrayInt  a,
ArrayInt  b 
)
inlinestatic

Returns the result of "a & ~b".

Returns
r[i] = a[i] & ~b[i];

◆ AndNot() [2/4]

static ArrayMaskI Ogre::MathlibC::AndNot ( ArrayMaskI  a,
ArrayInt  b 
)
inlinestatic

◆ AndNot() [3/4]

static ArrayMaskI Ogre::MathlibC::AndNot ( ArrayInt  a,
ArrayMaskI  b 
)
inlinestatic

◆ AndNot() [4/4]

static ArrayMaskI Ogre::MathlibC::AndNot ( ArrayMaskI  a,
ArrayMaskI  b 
)
inlinestatic

◆ Cmov4()

static ArrayReal Ogre::MathlibC::Cmov4 ( ArrayReal  arg1,
ArrayReal  arg2,
ArrayMaskR  mask 
)
inlinestatic

Branchless conditional move for 4 floating point values.

Remarks
Will NOT work if any of the arguments contains Infinite or NaNs or non-floating point values. If an exact binary copy is needed,
See also
CmovRobust
Parameters
4floating point values. Can't be NaN or Inf
4floating point values. Can't be NaN or Inf
4values containing either 0 or 0xffffffff Any other value, the result is undefined
Returns
r[i] = mask[i] != 0 ? arg1[i] : arg2[i] Another way to say it: if( maskCondition[i] == true ) r[i] = arg1[i]; else arg2[i];

References Ogre::Math::isNaN().

◆ CmovRobust() [1/2]

static ArrayReal Ogre::MathlibC::CmovRobust ( ArrayReal  arg1,
ArrayReal  arg2,
ArrayMaskR  mask 
)
inlinestatic

Robust, branchless conditional move for a 128-bit value.

Remarks
If you're looking to copy 4 floating point values that do not contain Inf or Nans,
See also
Cmov4 which is faster. This is because switching between registers flagged as floating point to integer and back has a latency delay

For more information refer to Chapter 3.5.2.3 Bypass between Execution Domains, IntelĀ® 64 and IA-32 Architectures Optimization Reference Manual Order Number: 248966-026 April (and also Table 2-12)

Parameters
Avalue containing 128 bits
Avalue containing 128 bits
Mask,eachbit is evaluated
Returns
For each bit: r[i] = mask[i] != 0 ? arg1[i] : arg2[i] Another way to say it: if( maskCondition[i] == true ) r[i] = arg1[i]; else arg2[i];

◆ CmovRobust() [2/2]

static ArrayInt Ogre::MathlibC::CmovRobust ( ArrayInt  arg1,
ArrayInt  arg2,
ArrayMaskI  mask 
)
inlinestatic

◆ ColapseMax()

static Real Ogre::MathlibC::ColapseMax ( ArrayReal  a)
inlinestatic

Returns the maximum value of all elements in a.

Returns
r[0] = max( a[0], a[1], a[2], a[3] )

◆ ColapseMin()

static Real Ogre::MathlibC::ColapseMin ( ArrayReal  a)
inlinestatic

Returns the minimum value of all elements in a.

Returns
r[0] = min( a[0], a[1], a[2], a[3] )

◆ CompareGreater()

static ArrayMaskR Ogre::MathlibC::CompareGreater ( ArrayReal  a,
ArrayReal  b 
)
inlinestatic

Returns the result of "a > b".

Returns
r[i] = a[i] > b[i] ? 0xffffffff : 0;

◆ CompareGreaterEqual()

static ArrayMaskR Ogre::MathlibC::CompareGreaterEqual ( ArrayReal  a,
ArrayReal  b 
)
inlinestatic

Returns the result of "a >= b".

Returns
r[i] = a[i] >= b[i] ? 0xffffffff : 0;

Referenced by Ogre::ArrayRay::intersects().

◆ CompareLess()

static ArrayMaskR Ogre::MathlibC::CompareLess ( ArrayReal  a,
ArrayReal  b 
)
inlinestatic

Returns the result of "a < b".

Returns
r[i] = a[i] < b[i] ? 0xffffffff : 0;

◆ CompareLessEqual()

static ArrayMaskR Ogre::MathlibC::CompareLessEqual ( ArrayReal  a,
ArrayReal  b 
)
inlinestatic

Returns the result of "a <= b".

Returns
r[i] = a[i] <= b[i] ? 0xffffffff : 0;

◆ Cos4()

static ArrayReal Ogre::MathlibC::Cos4 ( ArrayReal  x)
inlinestatic

Returns the cosine of x.

Parameters
x4 floating point values
Returns
cos( x ) (packed as 4 floats)

◆ Inv4()

static ArrayReal Ogre::MathlibC::Inv4 ( ArrayReal  val)
inlinestatic

Returns the reciprocal of x.

Remarks
If you have a very rough guarantees that you won't be feeding a zero, consider using
See also
InvNonZero4 because it's faster. See MathlibSSE2 implementation
Returns
1 / x (packed as 4 floats)

◆ InvNonZero4()

static ArrayReal Ogre::MathlibC::InvNonZero4 ( ArrayReal  val)
inlinestatic

Returns the reciprocal of x.

Remarks
If the input is zero, it will produce a NaN!!! (but it's faster) Note: Some architectures may slowdown when a NaN is produced, making this function slower than Inv4 for those cases
See also
Inv4
Parameters
valIf it's zero, the returned value could be NaN depending on implementation
Returns
1 / x

◆ InvSqrt4()

static ArrayReal Ogre::MathlibC::InvSqrt4 ( ArrayReal  f)
inlinestatic

Returns the squared root of the reciprocal of x.

Returns
1 / sqrt( x )

◆ InvSqrtNonZero4()

static ArrayReal Ogre::MathlibC::InvSqrtNonZero4 ( ArrayReal  f)
inlinestatic

Returns the squared root of the reciprocal of x.

Returns
1 / sqrt( x ) (packed as 4 floats)

◆ isInfinity()

static ArrayMaskR Ogre::MathlibC::isInfinity ( ArrayReal  a)
inlinestatic

Returns the result of "a == std::numeric_limits<float>::infinity()".

Returns
r[i] = a[i] == Inf ? 0xffffffff : 0;

◆ Max()

static ArrayReal Ogre::MathlibC::Max ( ArrayReal  a,
ArrayReal  b 
)
inlinestatic

Returns the maximum value between a and b.

References Ogre::max().

Referenced by Ogre::ArrayRay::intersects().

◆ Min()

static ArrayReal Ogre::MathlibC::Min ( ArrayReal  a,
ArrayReal  b 
)
inlinestatic

Returns the minimum value between a and b.

References Ogre::min().

Referenced by Ogre::ArrayRay::intersects().

◆ Modf4()

static ArrayReal Ogre::MathlibC::Modf4 ( ArrayReal  x,
ArrayReal outIntegral 
)
inlinestatic

Break x into fractional and integral parts.

Parameters
4floating point values. i.e. "2.57" (x4)
xThe integral part of x. i.e. 2
Returns
outIntegral The fractional part of x. i.e. 0.57

◆ Or() [1/4]

static ArrayInt Ogre::MathlibC::Or ( ArrayInt  a,
ArrayInt  b 
)
inlinestatic

Returns the result of "a | b".

Returns
r[i] = a[i] | b[i];

◆ Or() [2/4]

static ArrayMaskI Ogre::MathlibC::Or ( ArrayMaskI  a,
ArrayMaskI  b 
)
inlinestatic

◆ Or() [3/4]

static ArrayMaskI Ogre::MathlibC::Or ( ArrayMaskI  a,
ArrayInt  b 
)
inlinestatic

◆ Or() [4/4]

static ArrayMaskI Ogre::MathlibC::Or ( ArrayInt  a,
ArrayMaskI  b 
)
inlinestatic

◆ Set()

static void Ogre::MathlibC::Set ( ArrayReal dst,
Real  val,
size_t  index 
)
inlinestatic

◆ SetAll() [1/2]

static ArrayReal Ogre::MathlibC::SetAll ( Real  val)
inlinestatic

◆ SetAll() [2/2]

static ArrayInt Ogre::MathlibC::SetAll ( uint32  val)
inlinestatic

◆ Sin4()

static ArrayReal Ogre::MathlibC::Sin4 ( ArrayReal  x)
inlinestatic

Returns the sine of x.

Parameters
x4 floating point values
Returns
sin( x ) (packed as 4 floats)

◆ SinCos4()

static void Ogre::MathlibC::SinCos4 ( ArrayReal  x,
ArrayReal outSin,
ArrayReal outCos 
)
static

Calculates the cosine & sine of x.

Use this function if you need to calculate both, as it is faster than calling Cos4 & Sin4 together.

Parameters
x4 floating point values
outSinOutput value, sin( x ) (packed as 4 floats)
outCosOutput value, cos( x ) (packed as 4 floats)

◆ TestFlags4() [1/3]

static ArrayMaskI Ogre::MathlibC::TestFlags4 ( ArrayInt  a,
ArrayInt  b 
)
inlinestatic

Test if "a AND b" will result in non-zero, returning 0xffffffff on those cases.

Returns
r[i] = (a[i] & b[i]) ? 0xffffffff : 0;

◆ TestFlags4() [2/3]

static ArrayMaskI Ogre::MathlibC::TestFlags4 ( ArrayMaskI  a,
ArrayInt  b 
)
inlinestatic

◆ TestFlags4() [3/3]

static ArrayMaskI Ogre::MathlibC::TestFlags4 ( ArrayInt  a,
ArrayMaskI  b 
)
inlinestatic

Member Data Documentation

◆ fDeg2Rad

const ArrayReal Ogre::MathlibC::fDeg2Rad
static

◆ fEpsilon

const ArrayReal Ogre::MathlibC::fEpsilon
static

◆ FLOAT_MIN

const ArrayReal Ogre::MathlibC::FLOAT_MIN
static

◆ fRad2Deg

const ArrayReal Ogre::MathlibC::fRad2Deg
static

◆ fSqEpsilon

const ArrayReal Ogre::MathlibC::fSqEpsilon
static

◆ HALF

const ArrayReal Ogre::MathlibC::HALF
static

◆ INFINITEA

const ArrayReal Ogre::MathlibC::INFINITEA
static

◆ MAX_NEG

const ArrayReal Ogre::MathlibC::MAX_NEG
static

◆ MAX_POS

const ArrayReal Ogre::MathlibC::MAX_POS
static

◆ NEG_ONE

const ArrayReal Ogre::MathlibC::NEG_ONE
static

◆ ONE

const ArrayReal Ogre::MathlibC::ONE
static

◆ ONE_DIV_2PI

const ArrayReal Ogre::MathlibC::ONE_DIV_2PI
static

◆ OneMinusEpsilon

const ArrayReal Ogre::MathlibC::OneMinusEpsilon
static

◆ PI

const ArrayReal Ogre::MathlibC::PI
static

◆ SIGN_MASK

const ArrayReal Ogre::MathlibC::SIGN_MASK
static

◆ THREE

const ArrayReal Ogre::MathlibC::THREE
static

◆ TWO_PI

const ArrayReal Ogre::MathlibC::TWO_PI
static

The documentation for this class was generated from the following file: