Math

Macros

#define SIZEOF(x)
 

Functions

Float32 FMin (Float32 a, Float32 b)
 
Float64 FMin (Float64 a, Float64 b)
 
Int32 LMin (Int32 a, Int32 b)
 
Int VMin (Int a, Int b)
 
Float32 FMax (Float32 a, Float32 b)
 
Float64 FMax (Float64 a, Float64 b)
 
Int32 LMax (Int32 a, Int32 b)
 
Int VMax (Int a, Int b)
 
Int32 LCut (Int32 a, Int32 b, Int32 c)
 
Int VCut (Int a, Int b, Int c)
 
Float32 FCut (Float32 a, Float32 b, Float32 c)
 
Float64 FCut (Float64 a, Float64 b, Float64 c)
 
Float32 Clamp01 (Float32 a)
 
Float64 Clamp01 (Float64 a)
 
Float32 Sin (Float32 val)
 
Float64 Sin (Float64 val)
 
Float32 Cos (Float32 val)
 
Float64 Cos (Float64 val)
 
Float32 Tan (Float32 val)
 
Float64 Tan (Float64 val)
 
Float32 ATan (Float32 val)
 
Float64 ATan (Float64 val)
 
Float32 ATan2 (Float32 valA, Float32 valB)
 
Float64 ATan2 (Float64 valA, Float64 valB)
 
Float32 Exp (Float32 val)
 
Float64 Exp (Float64 val)
 
Float32 Ln (Float32 val)
 
Float64 Ln (Float64 val)
 
Float32 Log10 (Float32 val)
 
Float64 Log10 (Float64 val)
 
Float32 Log2 (Float32 val)
 
Float64 Log2 (Float64 val)
 
Float32 Sqrt (Float32 val)
 
Float64 Sqrt (Float64 val)
 
Float32 Floor (Float32 val)
 
Float64 Floor (Float64 val)
 
Float32 Ceil (Float32 val)
 
Float64 Ceil (Float64 val)
 
Float32 Pow (Float32 v1, Float32 v2)
 
Float64 Pow (Float64 v1, Float64 v2)
 
Float32 Sinh (Float32 val)
 
Float64 Sinh (Float64 val)
 
Float32 Cosh (Float32 val)
 
Float64 Cosh (Float64 val)
 
Float32 Tanh (Float32 val)
 
Float64 Tanh (Float64 val)
 
Float32 FMod (Float32 v1, Float32 v2)
 
Float64 FMod (Float64 v1, Float64 v2)
 
Float32 Abs (Float32 f)
 
Float64 Abs (Float64 f)
 
Float32 Inverse (Float32 f)
 
Float64 Inverse (Float64 f)
 
template<typename X >
Abs (X f)
 
template<typename X >
Min (X a, X b)
 
template<typename X >
Max (X a, X b)
 
template<typename X >
void Swap (X &a, X &b)
 
template<typename X >
ClampValue (X value, X lowerLimit, X upperLimit)
 
template<typename X , typename Y >
Blend (const X &value1, const X &value2, Y blendValue)
 
template<typename X >
Float Sqr (X a, X b)
 
template<typename X >
Float Sqr (X a)
 
Float32 ASin (Float32 val)
 
Float64 ASin (Float64 val)
 
Float32 ACos (Float32 val)
 
Float64 ACos (Float64 val)
 
Float32 DegToRad (Float32 r)
 
Float64 DegToRad (Float64 r)
 
Float32 RadToDeg (Float32 r)
 
Float64 RadToDeg (Float64 r)
 
void SinCos (Float32 val, Float32 &sn, Float32 &cs)
 
void SinCos (Float64 val, Float64 &sn, Float64 &cs)
 

Variables

static const Float64 PI
 
static const Float64 PI_INV
 
static const Float64 PI2
 
static const Float64 PI2_INV
 
static const Float64 PI05
 

Detailed Description

Macro Definition Documentation

◆ SIZEOF

#define SIZEOF (   x)

Calculates the size of a data type or element.

Function Documentation

◆ FMin() [1/2]

Float32 cineware::FMin ( Float32  a,
Float32  b 
)

Gets the minimum value of a and b parameters.

Parameters
[in]aA value.
[in]bA value.
Returns
The minimum value of a and b.

◆ FMin() [2/2]

Float64 cineware::FMin ( Float64  a,
Float64  b 
)

Gets the minimum value of a and b parameters.

Parameters
[in]aA value.
[in]bA value.
Returns
The minimum value of a and b.

◆ LMin()

Int32 cineware::LMin ( Int32  a,
Int32  b 
)

Gets the minimum value of a and b parameters.

Parameters
[in]aA value.
[in]bA value.
Returns
The minimum value of a and b.

◆ VMin()

Int cineware::VMin ( Int  a,
Int  b 
)

Gets the minimum value of a and b parameters.

Parameters
[in]aA value.
[in]bA value.
Returns
The minimum value of a and b.

◆ FMax() [1/2]

Float32 cineware::FMax ( Float32  a,
Float32  b 
)

Gets the maximum value of a and b parameters.

Parameters
[in]aA value.
[in]bA value.
Returns
The maximum value of a and b.

◆ FMax() [2/2]

Float64 cineware::FMax ( Float64  a,
Float64  b 
)

Gets the maximum value of a and b parameters.

Parameters
[in]aA value.
[in]bA value.
Returns
The maximum value of a and b.

◆ LMax()

Int32 cineware::LMax ( Int32  a,
Int32  b 
)

Gets the maximum value of a and b parameters.

Parameters
[in]aA value.
[in]bA value.
Returns
The maximum value of a and b.

◆ VMax()

Int cineware::VMax ( Int  a,
Int  b 
)

Gets the maximum value of a and b parameters.

Parameters
[in]aA value.
[in]bA value.
Returns
The maximum value of a and b.

◆ LCut()

Int32 cineware::LCut ( Int32  a,
Int32  b,
Int32  c 
)

Limits the value of a between b and c.

Parameters
[in]aA value.
[in]bLower bound.
[in]cUpper bound.
Returns
b if a < b, c if a > c, otherwise a.

◆ VCut()

Int cineware::VCut ( Int  a,
Int  b,
Int  c 
)

Limits the value of a between b and c.

Parameters
[in]aA value.
[in]bLower bound.
[in]cUpper bound.
Returns
b if a < b, c if a > c, otherwise a.

◆ FCut() [1/2]

Float32 cineware::FCut ( Float32  a,
Float32  b,
Float32  c 
)

Limits the value of a between b and c.

Parameters
[in]aA value.
[in]bLower bound.
[in]cUpper bound.
Returns
b if a < b, c if a > c, otherwise a.

◆ FCut() [2/2]

Float64 cineware::FCut ( Float64  a,
Float64  b,
Float64  c 
)

Limits the value of a between b and c.

Parameters
[in]aA value.
[in]bLower bound.
[in]cUpper bound.
Returns
b if a < b, c if a > c, otherwise a.

◆ Clamp01() [1/2]

Float32 cineware::Clamp01 ( Float32  a)

Clips a single-precision floating point number against the lower limit 0 and the upper limit 0 1.

Parameters
[in]aA value.
Returns
a value clamped.

◆ Clamp01() [2/2]

Float64 cineware::Clamp01 ( Float64  a)

Clips a single-precision floating point number against the lower limit 0 and the upper limit 1.

Parameters
[in]aA value.
Returns
a value clamped.

◆ Sin() [1/2]

Float32 cineware::Sin ( Float32  val)

Calculates the sine of val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated sine.

◆ Sin() [2/2]

Float64 cineware::Sin ( Float64  val)

Calculates the sine of val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated sine.

◆ Cos() [1/2]

Float32 cineware::Cos ( Float32  val)

Calculates the cosine of val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated sine.

◆ Cos() [2/2]

Float64 cineware::Cos ( Float64  val)

Calculates the cosine of val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated sine.

◆ Tan() [1/2]

Float32 cineware::Tan ( Float32  val)

Calculates the tangent of val.

Note
The input value needs to be checked for proper range, so that no exceptions will be generated.
Parameters
[in]valA single-precision floating point value.
Returns
The calculated tangent.

◆ Tan() [2/2]

Float64 cineware::Tan ( Float64  val)

Calculates the tangent of val.

Note
The input value needs to be checked for proper range, so that no exceptions will be generated.
Parameters
[in]valA double-precision floating point value.
Returns
The calculated tangent.

◆ ATan() [1/2]

Float32 cineware::ATan ( Float32  val)

Calculates the arctangent of val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated arctangent.

◆ ATan() [2/2]

Float64 cineware::ATan ( Float64  val)

Calculates the arctangent of val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated arctangent.

◆ ATan2() [1/2]

Float32 cineware::ATan2 ( Float32  valA,
Float32  valB 
)

Calculates the arctangent2 of valA and valB.

Parameters
[in]valAA single-precision floating point value.
[in]valBA single-precision floating point value.
Returns
The calculated arctangent2.

◆ ATan2() [2/2]

Float64 cineware::ATan2 ( Float64  valA,
Float64  valB 
)

Calculates the arctangent2 of valA and valB.

Parameters
[in]valAA double-precision floating point value.
[in]valBA double-precision floating point value.
Returns
The calculated arctangent2.

◆ Exp() [1/2]

Float32 cineware::Exp ( Float32  val)

Calculates e^val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated exponential value.

◆ Exp() [2/2]

Float64 cineware::Exp ( Float64  val)

Calculates e^val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated exponential value.

◆ Ln() [1/2]

Float32 cineware::Ln ( Float32  val)

Calculates logarithm of val.

Note
The input needs to be positive, so that no exceptions will be generated.
Parameters
[in]valA single-precision floating point value.
Returns
The calculated logarithm value.

◆ Ln() [2/2]

Float64 cineware::Ln ( Float64  val)

Calculates logarithm of val.

Note
The input needs to be positive, so that no exceptions will be generated.
Parameters
[in]valA double-precision floating point value.
Returns
The calculated logarithm value.

◆ Log10() [1/2]

Float32 cineware::Log10 ( Float32  val)

Calculates logarithm with base 10 of val.

Note
The input needs to be positive, so that no exceptions will be generated.
Parameters
[in]valA single-precision floating point value.
Returns
The calculated logarithm with base 10 value.

◆ Log10() [2/2]

Float64 cineware::Log10 ( Float64  val)

Calculates logarithm with base 10 of val.

Note
The input needs to be positive, so that no exceptions will be generated.
Parameters
[in]valA double-precision floating point value.
Returns
The calculated logarithm with base 10 value.

◆ Log2() [1/2]

Float32 cineware::Log2 ( Float32  val)

Calculates logarithm with base 2 of val.

Note
The input needs to be positive, so that no exceptions will be generated.
Parameters
[in]valA single-precision floating point value.
Returns
The calculated logarithm with base 2 value.

◆ Log2() [2/2]

Float64 cineware::Log2 ( Float64  val)

Calculates logarithm with base 2 of val.

Note
The input needs to be positive, so that no exceptions will be generated.
Parameters
[in]valA double-precision floating point value.
Returns
The calculated logarithm with base 2 value.

◆ Sqrt() [1/2]

Float32 cineware::Sqrt ( Float32  val)

Calculates square root of val.

Note
The input needs to be positive, so that no exceptions will be generated.
Parameters
[in]valA single-precision floating point value.
Returns
The calculated square root value.

◆ Sqrt() [2/2]

Float64 cineware::Sqrt ( Float64  val)

Calculates square root of val.

Note
The input needs to be positive, so that no exceptions will be generated.
Parameters
[in]valA double-precision floating point value.
Returns
The calculated square root value.

◆ Floor() [1/2]

Float32 cineware::Floor ( Float32  val)

Calculates the largest previous integer number of val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated floor value.

◆ Floor() [2/2]

Float64 cineware::Floor ( Float64  val)

Calculates the largest previous integer number of val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated floor value.

◆ Ceil() [1/2]

Float32 cineware::Ceil ( Float32  val)

Calculates the smallest following integer number of val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated ceil value.

◆ Ceil() [2/2]

Float64 cineware::Ceil ( Float64  val)

Calculates the smallest following integer number of val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated ceil value.

◆ Pow() [1/2]

Float32 cineware::Pow ( Float32  v1,
Float32  v2 
)

Calculates v1^v2.

Parameters
[in]v1A single-precision floating point value.
[in]v2A single-precision floating point value.
Returns
The calculated pow value.

◆ Pow() [2/2]

Float64 cineware::Pow ( Float64  v1,
Float64  v2 
)

Calculates v1^v2.

Parameters
[in]v1A double-precision floating point value.
[in]v2A double-precision floating point value.
Returns
The calculated pow value.

◆ Sinh() [1/2]

Float32 cineware::Sinh ( Float32  val)

Calculates hyperbolic sine of val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated hyperbolic sine value.

◆ Sinh() [2/2]

Float64 cineware::Sinh ( Float64  val)

Calculates hyperbolic sine of val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated hyperbolic sine value.

◆ Cosh() [1/2]

Float32 cineware::Cosh ( Float32  val)

Calculates hyperbolic cosine of val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated hyperbolic cosine value.

◆ Cosh() [2/2]

Float64 cineware::Cosh ( Float64  val)

Calculates hyperbolic cosine of val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated hyperbolic cosine value.

◆ Tanh() [1/2]

Float32 cineware::Tanh ( Float32  val)

Calculates hyperbolic tangent of val.

Parameters
[in]valA single-precision floating point value.
Returns
The calculated hyperbolic tangent value.

◆ Tanh() [2/2]

Float64 cineware::Tanh ( Float64  val)

Calculates hyperbolic tangent of val.

Parameters
[in]valA double-precision floating point value.
Returns
The calculated hyperbolic tangent value.

◆ FMod() [1/2]

Float32 cineware::FMod ( Float32  v1,
Float32  v2 
)

Calculates floating point modulo v1%v2.

Parameters
[in]v1A single-precision floating point value. The quotient numerator.
[in]v2A single-precision floating point value. The quotient denominator.
Returns
The remainder of dividing v1 and v2.

◆ FMod() [2/2]

Float64 cineware::FMod ( Float64  v1,
Float64  v2 
)

Calculates floating point modulo v1%v2.

Parameters
[in]v1A double-precision floating point value. The quotient numerator.
[in]v2A double-precision floating point value. The quotient denominator.
Returns
The remainder of dividing v1 and v2.

◆ Abs() [1/3]

Float32 cineware::Abs ( Float32  f)

Calculates the absolute value of floating point number f.

Parameters
[in]fA single-precision floating point value.
Returns
The calculated absolute value.

◆ Abs() [2/3]

Float64 cineware::Abs ( Float64  f)

Calculates the absolute value of floating point number f.

Parameters
[in]fA double-precision floating point value.
Returns
The calculated absolute value.

◆ Inverse() [1/2]

Float32 cineware::Inverse ( Float32  f)

Calculates the reciprocal (multiplicative inverse) of val.

Note
If the input value is zero, zero will be returned for safety to avoid exceptions.
Parameters
[in]fA single-precision floating point value.
Returns
The calculated inverse value.

◆ Inverse() [2/2]

Float64 cineware::Inverse ( Float64  f)

Calculates the reciprocal (multiplicative inverse) of val.

Note
If the input value is zero, zero will be returned for safety to avoid exceptions.
Parameters
[in]fA double-precision floating point value.
Returns
The calculated inverse value.

◆ Abs() [3/3]

X cineware::Abs ( f)

Calculates the absolute value of f.

Parameters
[in]fThe value to get its absolute.
Returns
The absolute value.

◆ Min()

X cineware::Min ( a,
b 
)

Calculates the minimum of a and b.

Parameters
[in]aA value.
[in]bA value.
Returns
The minimum.

◆ Max()

X cineware::Max ( a,
b 
)

Calculates the maximum a and b.

Parameters
[in]aA value.
[in]bA value.
Returns
The maximum.

◆ Swap()

void cineware::Swap ( X &  a,
X &  b 
)

Swaps values a and b.

Note
If available, move semantics will be used.
Parameters
[in]aA value.
[in]bA value.

◆ ClampValue()

X cineware::ClampValue ( value,
lowerLimit,
upperLimit 
)

Clips a value against a lower and upper limit.

Parameters
[in]valueThe value to clamp.
[in]lowerLimitThe lower limit.
[in]upperLimitThe upper limit.
Returns
The clamped value.

◆ Blend()

X cineware::Blend ( const X &  value1,
const X &  value2,
blendValue 
)

Blends values value1 and value2.

Parameters
[in]value1The first value in the range to blend.
[in]value2The second value in the range to blend.
[in]blendValueThe blend value.
Returns
If blendValue is 0.0 value1 is returned.
If blendValue is 1.0 value2 is returned.
No clipping below 0.0 or 1.0 takes place. In that case use BoxStep.

◆ Sqr() [1/2]

Float cineware::Sqr ( a,
b 
)

Calculates square difference of a and b.

Parameters
[in]aA value.
[in]bA value.
Returns
The square difference.

◆ Sqr() [2/2]

Float cineware::Sqr ( a)

Calculates square of a.

Parameters
[in]aA value.
Returns
The square.

◆ ASin() [1/2]

Float32 cineware::ASin ( Float32  val)

Calculates arc sine of val.

Note
The input value is clipped for safety to avoid exceptions.
Parameters
[in]valA single-precision floating point value.
Returns
The calculated arcsine value.

◆ ASin() [2/2]

Float64 cineware::ASin ( Float64  val)

Calculates arc sine of val.

Note
The input value is clipped for safety to avoid exceptions.
Parameters
[in]valA double-precision floating point value.
Returns
The calculated arcsine value.

◆ ACos() [1/2]

Float32 cineware::ACos ( Float32  val)

Calculates arc cosine of val.

Note
The input value is clipped for safety to avoid exceptions.
Parameters
[in]valA single-precision floating point value.
Returns
The calculated arc cosine value.

◆ ACos() [2/2]

Float64 cineware::ACos ( Float64  val)

Calculates arc cosine of val.

Note
The input value is clipped for safety to avoid exceptions.
Parameters
[in]valA double-precision floating point value.
Returns
The calculated arc cosine value.

◆ DegToRad() [1/2]

Float32 cineware::DegToRad ( Float32  r)

Converts val from degrees to radians.

Parameters
[in]rA single-precision floating point value.
Returns
The converted degrees to radians value.

◆ DegToRad() [2/2]

Float64 cineware::DegToRad ( Float64  r)

Converts val from degrees to radians.

Parameters
[in]rA double-precision floating point value.
Returns
The converted degrees to radians value.

◆ RadToDeg() [1/2]

Float32 cineware::RadToDeg ( Float32  r)

Converts val from radians to degrees.

Parameters
[in]rA single-precision floating point value.
Returns
The converted radians to degrees value.

◆ RadToDeg() [2/2]

Float64 cineware::RadToDeg ( Float64  r)

Converts val from radians to degrees.

Parameters
[in]rA double-precision floating point value.
Returns
The converted radians to degrees value.

◆ SinCos() [1/2]

void cineware::SinCos ( Float32  val,
Float32 sn,
Float32 cs 
)

Calculates both sine and cosine of val.

Parameters
[in]valA single-precision floating point value.
[out]snAssigned the calculated sine value.
[out]csAssigned the calculated cosine value.

◆ SinCos() [2/2]

void cineware::SinCos ( Float64  val,
Float64 sn,
Float64 cs 
)

Calculates both sine and cosine of val.

Parameters
[in]valA single-precision floating point value.
[out]snAssigned the calculated sine value.
[out]csAssigned the calculated cosine value.

Variable Documentation

◆ PI

const Float64 PI
static

Constant for PI.

◆ PI_INV

const Float64 PI_INV
static

Constant for 1.0 / PI.

◆ PI2

const Float64 PI2
static

Constant for 2.0 * PI.

◆ PI2_INV

const Float64 PI2_INV
static

Constant for 1.0 / (2.0 * PI)

◆ PI05

const Float64 PI05
static

Constant for 0.5 * PI.