Mathematic functions (Trigonometric, exponential, rounding, etc.). More...
Functions | |
template<class DataType > | |
DataType | Murl::Math::Abs (DataType value) |
Get the absolute value. More... | |
template<class DataType > | |
DataType | Murl::Math::Sgn (DataType value) |
Get the sign of a value. More... | |
template<class DataType > | |
const DataType & | Murl::Math::Min (const DataType &x, const DataType &y) |
Get the minimum of two values. More... | |
template<class DataType > | |
const DataType & | Murl::Math::Min (const DataType &x, const DataType &y, const DataType &z) |
Get the minimum of three values. More... | |
template<class DataType > | |
const DataType & | Murl::Math::Min (const DataType &x, const DataType &y, const DataType &z, const DataType &w) |
Get the minimum of four values. More... | |
template<class DataType > | |
const DataType & | Murl::Math::Max (const DataType &x, const DataType &y) |
Get the maximum of two values. More... | |
template<class DataType > | |
const DataType & | Murl::Math::Max (const DataType &x, const DataType &y, const DataType &z) |
Get the maximum of three values. More... | |
template<class DataType > | |
const DataType & | Murl::Math::Max (const DataType &x, const DataType &y, const DataType &z, const DataType &w) |
Get the maximum of four values. More... | |
template<class DataType > | |
const DataType & | Murl::Math::Clamp (const DataType &val, const DataType &min, const DataType &max) |
Clamp a value. More... | |
template<class DataType > | |
Bool | Murl::Math::IsNaN (DataType value) |
Check if a value is not a number (NaN). More... | |
template<class DataType > | |
Bool | Murl::Math::IsInfinite (DataType value) |
Check if a value is infinite (either positive infinity or negative infinity). More... | |
template<class DataType > | |
Bool | Murl::Math::IsFinite (DataType value) |
Check if a value is finite. More... | |
template<class DataType > | |
DataType | Murl::Math::Exp (DataType value) |
Get the the e number raised to the power of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::Log (DataType value) |
Get the natural logarithm of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::Log2 (DataType value) |
Get the base 2 logarithm of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::Log10 (DataType value) |
Get the base 10 logarithm of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::Sqrt (DataType value) |
Get the square root of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::Pow (DataType base, DataType exponent) |
Get a base raised to the power of an exponent. More... | |
template<class DataType > | |
DataType | Murl::Math::Fmod (DataType numerator, DataType denominator) |
Get the remainder of a numerator divided by a denominator. More... | |
template<class DataType > | |
DataType | Murl::Math::ModF (DataType value, DataType &intPart) |
Get the integer part and the fractional part of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::Remainder (DataType numerator, DataType denominator) |
Get the IEEE remainder of a numerator divided by a denominator. More... | |
template<class DataType > | |
DataType | Murl::Math::Sin (DataType radAngle) |
Get the sine of an angle value. More... | |
template<class DataType > | |
DataType | Murl::Math::Cos (DataType radAngle) |
Get the cosine of an angle value. More... | |
template<class DataType > | |
DataType | Murl::Math::Tan (DataType radAngle) |
Get the tangent of an angle value. More... | |
template<class DataType > | |
DataType | Murl::Math::ArcSin (DataType value) |
Get the arc sine of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::ArcCos (DataType value) |
Get the arc cosine of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::ArcTan (DataType value) |
Get the arc tangent of a value. More... | |
template<class DataType > | |
DataType | Murl::Math::ArcTan2 (DataType y, DataType x) |
Get the arc tangent of y divided by x. More... | |
template<class DataType > | |
DataType | Murl::Math::SinHyp (DataType value) |
Get the hyperbolic sine of an value. More... | |
template<class DataType > | |
DataType | Murl::Math::CosHyp (DataType value) |
Get the hyperbolic cosine of an value. More... | |
template<class DataType > | |
DataType | Murl::Math::TanHyp (DataType value) |
Get the hyperbolic tangent of an value. More... | |
template<class DataType > | |
DataType | Murl::Math::ArcSinHyp (DataType value) |
Get the hyperbolic arc sine of an value. More... | |
template<class DataType > | |
DataType | Murl::Math::ArcCosHyp (DataType value) |
Get the hyperbolic arc cosine of an value. More... | |
template<class DataType > | |
DataType | Murl::Math::ArcTanHyp (DataType value) |
Get the hyperbolic arc tangent of an value. More... | |
template<class DataType > | |
DataType | Murl::Math::Floor (DataType value) |
Round down to an integral value. More... | |
template<class DataType > | |
DataType | Murl::Math::Ceil (DataType value) |
Round up to an integral value. More... | |
template<class DataType > | |
DataType | Murl::Math::Round (DataType value) |
Round to an integral value, regardless of the rounding direction. More... | |
template<class DataType > | |
Bool | Murl::Math::IsEqual (const DataType &a, const DataType &b, const DataType &epsilon=Limits< DataType >::Epsilon()) |
Check if two values are equal within an epsilon range. More... | |
template<class DataType > | |
DataType | Murl::Math::DegToRad (DataType degrees) |
Convert degrees into radiants. More... | |
template<class DataType > | |
DataType | Murl::Math::RadToDeg (DataType radiants) |
Convert radiants into degrees. More... | |
template<class DataType > | |
DataType | Murl::Math::MapAngle (DataType angle) |
Map an angle into range [-PI . More... | |
template<class DataType > | |
DataType | Murl::Math::AddAngle (DataType angle1, DataType angle2) |
Calculate the sum of two angles. More... | |
template<class DataType > | |
DataType | Murl::Math::SubAngle (DataType angle1, DataType angle2) |
Calculate the difference between two angles. More... | |
UInt16 | Murl::Math::FloatToHalfFloat (Float value) |
Convert a given 32bit float value to 16bit ("half float"), represented by a UInt16 integer. More... | |
UInt16 | Murl::Math::IntToHalfFloat (UInt8 value) |
Convert a given 8bit unsigned integer value to a 16bit floating point value ("half float"), represented by a UInt16 integer. More... | |
Float | Murl::Math::HalfFloatToFloat (UInt16 value) |
Convert a given 16bit half float value stored in a UInt16 to a 32bit float value. More... | |
UInt8 | Murl::Math::HalfFloatToInt (UInt16 value) |
Convert a given 16bit half float value stored in a UInt16 to a 8bit unsigned integer value. More... | |
UInt16 | Murl::Math::FloatToPackedFloat11 (Float value) |
Convert a given 32bit float value to an 11bit packed float, represented by a UInt16 integer. More... | |
Float | Murl::Math::PackedFloat11ToFloat (UInt16 value) |
Convert a given packed 11bit float value stored in a UInt16 to a 32bit float value. More... | |
UInt16 | Murl::Math::FloatToPackedFloat10 (Float value) |
Convert a given 32bit float value to an 10bit packed float, represented by a UInt16 integer. More... | |
Float | Murl::Math::PackedFloat10ToFloat (UInt16 value) |
Convert a given packed 10bit float value stored in a UInt16 to a 32bit float value. More... | |
template<class DataTypeV , class DataTypeT > | |
DataTypeV | Murl::Math::Lerp (const DataTypeV &startValue, const DataTypeV &endValue, DataTypeT t) |
The linear interpolation template function. More... | |
template<class DataTypeT > | |
Double | Murl::Math::Lerp (Double startValue, Double endValue, DataTypeT t) |
The linear interpolation template function for Double. More... | |
template<class DataTypeV , class DataTypeT > | |
DataTypeT | Murl::Math::GetCubicBezierParameter (DataTypeV x0, DataTypeV x1, DataTypeV x2, DataTypeV x3, DataTypeV x) |
Get the cubic bezier parameter t for a given X value. More... | |
template<class DataTypeV , class DataTypeT > | |
DataTypeV | Murl::Math::CubicBezier (DataTypeV x0, DataTypeV x1, DataTypeV x2, DataTypeV x3, DataTypeT t) |
Evaluate a cubic bezier curve for a given parameter t. More... | |
template<class DataTypeV > | |
DataTypeV | Murl::Math::CubicBezierAt (DataTypeV x0, DataTypeV x1, DataTypeV x2, DataTypeV x3, DataTypeV y0, DataTypeV y1, DataTypeV y2, DataTypeV y3, DataTypeV x) |
Evaluate a cubic bezier curve at a given X value. More... | |
template<class DataType > | |
Easing< DataType >::Interpolate | Murl::Math::GetEasingFunction (IEnums::Interpolation interpolation) |
Get the Easing::Interpolate function for a specified interpolation. More... | |
template<class DataType > | |
DataType | Murl::Math::Interpolation (IEnums::Interpolation interpolation, DataType x) |
The interpolation template function calculates the IEnums::Interpolation curve (easing function). More... | |
Detailed Description
Mathematic functions (Trigonometric, exponential, rounding, etc.).
Basic mathematical functions available for Float and Double data type.
Function Documentation
◆ Abs()
DataType Murl::Math::Abs | ( | DataType | value | ) |
Get the absolute value.
- Parameters
-
value The input value.
- Returns
- The absolute value.
Referenced by Murl::Math::Vector< DataType >::Abs(), Murl::Math::Vector< DataType >::AbsSelf(), Murl::Util::BoxFilter::Apply(), Murl::Util::BilinearFilter::Apply(), Murl::Util::GaussianFilter::Apply(), Murl::Math::Vector< DataType >::GetBaseNormals(), Murl::Math::GetCubicBezierParameter(), Murl::Math::Matrix< DataType >::Invert(), Murl::Math::IsEqual(), Murl::Math::Matrix< DataType >::IsEqual(), Murl::Math::Quaternion< DataType >::IsEqual(), Murl::Math::Rectangle< DataType >::IsEqual(), Murl::Math::Vector< DataType >::IsEqual(), Murl::Math::Cone< DataType >::Set(), Murl::Math::Sphere< DataType >::SetBounding(), Murl::Math::Sphere< DataType >::SetContaining(), and Murl::Math::Matrix< DataType >::Solve().
◆ Sgn()
DataType Murl::Math::Sgn | ( | DataType | value | ) |
Get the sign of a value.
- Parameters
-
value The input value.
- Returns
- 1 if the value is positive, -1 if the value is negative or zero if the value is zero.
◆ Min() [1/3]
const DataType& Murl::Math::Min | ( | const DataType & | x, |
const DataType & | y | ||
) |
Get the minimum of two values.
If both are equivalent, x is returned.
- Parameters
-
x The 1st value. y The 2nd value.
- Returns
- The lesser value of x and y.
Referenced by Murl::Math::Clamp(), Murl::IAttributes::GetEnumValuesByIndex(), Murl::Math::Rectangle< DataType >::Include(), Murl::Math::Rectangle< DataType >::Intersect(), Murl::Math::Min(), Murl::Math::MinMax< DataType, LimitsType >::Reset(), Murl::Math::Rectangle< DataType >::Unite(), and Murl::Math::Sphere< DataType >::Unite().
◆ Min() [2/3]
const DataType& Murl::Math::Min | ( | const DataType & | x, |
const DataType & | y, | ||
const DataType & | z | ||
) |
Get the minimum of three values.
If all are equivalent, x is returned.
- Parameters
-
x The 1st value. y The 2nd value. z The 3rd value.
- Returns
- The lowest value of x, y and z.
References Murl::Math::Min().
◆ Min() [3/3]
const DataType& Murl::Math::Min | ( | const DataType & | x, |
const DataType & | y, | ||
const DataType & | z, | ||
const DataType & | w | ||
) |
Get the minimum of four values.
If all are equivalent, x is returned.
- Parameters
-
x The 1st value. y The 2nd value. z The 3rd value. w The 4th value.
- Returns
- The lowest value of x, y, z and w.
References Murl::Math::Min().
◆ Max() [1/3]
const DataType& Murl::Math::Max | ( | const DataType & | x, |
const DataType & | y | ||
) |
Get the maximum of two values.
If both are equivalent, x is returned.
- Parameters
-
x The 1st value. y The 2nd value.
- Returns
- The greater value of x and y.
Referenced by Murl::Math::Clamp(), Murl::Math::Rectangle< DataType >::GetSizeX(), Murl::Math::Rectangle< DataType >::GetSizeY(), Murl::Math::Sphere< DataType >::Include(), Murl::Math::Rectangle< DataType >::Include(), Murl::Math::Rectangle< DataType >::Intersect(), Murl::Math::Max(), Murl::Math::MinMax< DataType, LimitsType >::Reset(), Murl::Math::Quaternion< DataType >::Set(), Murl::Array< DataType >::SetCountAndReserve(), Murl::Math::Rectangle< DataType >::Unite(), and Murl::Math::Sphere< DataType >::Unite().
◆ Max() [2/3]
const DataType& Murl::Math::Max | ( | const DataType & | x, |
const DataType & | y, | ||
const DataType & | z | ||
) |
Get the maximum of three values.
If all are equivalent, x is returned.
- Parameters
-
x The 1st value. y The 2nd value. z The 3rd value.
- Returns
- The highest value of x, y and z.
References Murl::Math::Max().
◆ Max() [3/3]
const DataType& Murl::Math::Max | ( | const DataType & | x, |
const DataType & | y, | ||
const DataType & | z, | ||
const DataType & | w | ||
) |
Get the maximum of four values.
If all are equivalent, x is returned.
- Parameters
-
x The 1st value. y The 2nd value. z The 3rd value. w The 4th value.
- Returns
- The highest value of x, y, z and w.
References Murl::Math::Max().
◆ Clamp()
const DataType& Murl::Math::Clamp | ( | const DataType & | val, |
const DataType & | min, | ||
const DataType & | max | ||
) |
Clamp a value.
- Parameters
-
val The value to clamp. min The minimum value. max The maximum value.
- Returns
- The value clamped in range [min .. max].
References Murl::Math::Max(), and Murl::Math::Min().
Referenced by Murl::Math::FloatToHalfFloat(), Murl::Math::FloatToPackedFloat10(), Murl::Math::FloatToPackedFloat11(), Murl::Math::GetCubicBezierParameter(), Murl::Math::HalfFloatToFloat(), Murl::Math::HalfFloatToInt(), Murl::Math::Quaternion< DataType >::Interpolate(), Murl::Math::SplineBase< DataType >::Interpolate(), Murl::Math::PackedFloat10ToFloat(), and Murl::Math::PackedFloat11ToFloat().
◆ IsNaN()
Bool Murl::Math::IsNaN | ( | DataType | value | ) |
Check if a value is not a number (NaN).
The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the result of 0/0.
- Parameters
-
value The value to check.
- Returns
- true if the value is not a number (NaN).
◆ IsInfinite()
Bool Murl::Math::IsInfinite | ( | DataType | value | ) |
Check if a value is infinite (either positive infinity or negative infinity).
- Parameters
-
value The value to check.
- Returns
- true if the value is an infinity value.
◆ IsFinite()
Bool Murl::Math::IsFinite | ( | DataType | value | ) |
Check if a value is finite.
A finite value is any floating-point value that is neither infinite nor NaN.
- Parameters
-
value The value to check.
- Returns
- true if the value is finite.
◆ Exp()
DataType Murl::Math::Exp | ( | DataType | value | ) |
Get the the e number raised to the power of a value.
- Parameters
-
value The input value.
- Returns
- The the e number raised to the power of the value.
Referenced by Murl::Util::GaussianFilter::Apply().
◆ Log()
DataType Murl::Math::Log | ( | DataType | value | ) |
Get the natural logarithm of a value.
- Parameters
-
value The input value.
- Returns
- The natural logarithm of the value.
◆ Log2()
DataType Murl::Math::Log2 | ( | DataType | value | ) |
Get the base 2 logarithm of a value.
- Parameters
-
value The input value.
- Returns
- The base 2 logarithm of the value.
◆ Log10()
DataType Murl::Math::Log10 | ( | DataType | value | ) |
Get the base 10 logarithm of a value.
- Parameters
-
value The input value.
- Returns
- The base 10 logarithm of the value.
◆ Sqrt()
DataType Murl::Math::Sqrt | ( | DataType | value | ) |
Get the square root of a value.
- Parameters
-
value The input value.
- Returns
- The square root of the value.
Referenced by Murl::Math::Easing< DataType >::EaseCircularHelper(), Murl::Math::Easing< DataType >::EaseCircularIn(), Murl::Math::Easing< DataType >::EaseCircularOut(), Murl::Util::GaussianFilter::GaussianFilter(), Murl::Math::Vector< DataType >::GetAngle2D(), Murl::Math::Matrix< DataType >::GetEulerRotation(), Murl::Math::Vector< DataType >::GetLength(), Murl::Math::Matrix< DataType >::GetScalingComponent(), Murl::Math::Matrix< DataType >::GetScalingComponentX(), Murl::Math::Matrix< DataType >::GetScalingComponentY(), Murl::Math::Matrix< DataType >::GetScalingComponentZ(), Murl::Math::Sphere< DataType >::Include(), Murl::Math::Quaternion< DataType >::Normalize(), Murl::Math::Plane< DataType >::NormalizeSelf(), Murl::Math::Quaternion< DataType >::NormalizeSelf(), Murl::Math::Cylinder< DataType >::Set(), Murl::Math::Cone< DataType >::Set(), Murl::Math::Quaternion< DataType >::Set(), and Murl::Math::Vector< DataType >::Set().
◆ Pow()
DataType Murl::Math::Pow | ( | DataType | base, |
DataType | exponent | ||
) |
Get a base raised to the power of an exponent.
- Parameters
-
base The base input value. exponent The exponent input value.
- Returns
- The base raised to the power of the exponent.
Referenced by Murl::Math::Easing< DataType >::EaseElasticIn(), and Murl::Math::Easing< DataType >::EaseExponentialIn().
◆ Fmod()
DataType Murl::Math::Fmod | ( | DataType | numerator, |
DataType | denominator | ||
) |
Get the remainder of a numerator divided by a denominator.
- Parameters
-
numerator The numerator input value. denominator The denominator input value.
- Returns
- The remainder of the numerator divided by the denominator.
Referenced by Murl::Math::SplineBase< DataType >::Interpolate(), and Murl::Math::MapAngle().
◆ ModF()
DataType Murl::Math::ModF | ( | DataType | value, |
DataType & | intPart | ||
) |
Get the integer part and the fractional part of a value.
- Parameters
-
value The input value. intPart The integer part return value.
- Returns
- The fractional part of the value.
◆ Remainder()
DataType Murl::Math::Remainder | ( | DataType | numerator, |
DataType | denominator | ||
) |
Get the IEEE remainder of a numerator divided by a denominator.
- Parameters
-
numerator The numerator input value. denominator The denominator input value.
- Returns
- The IEEE remainder of the numerator divided by the denominator.
◆ Sin()
DataType Murl::Math::Sin | ( | DataType | radAngle | ) |
Get the sine of an angle value.
- Parameters
-
radAngle The angle value in radiants.
- Returns
- The sine of the angle value.
Referenced by Murl::Math::Cone< DataType >::Cone(), Murl::Math::Easing< DataType >::EaseBackIn(), Murl::Math::Easing< DataType >::EaseElasticIn(), Murl::Math::Matrix< DataType >::GetEulerRotation(), Murl::Math::Quaternion< DataType >::Interpolate(), Murl::Math::Quaternion< DataType >::Quaternion(), Murl::Math::Cone< DataType >::Set(), Murl::Math::Matrix< DataType >::SetRotationComponentAxisAngle(), Murl::Math::Matrix< DataType >::SetRotationComponentX(), Murl::Math::Matrix< DataType >::SetRotationComponentXYZ(), Murl::Math::Matrix< DataType >::SetRotationComponentY(), and Murl::Math::Matrix< DataType >::SetRotationComponentZ().
◆ Cos()
DataType Murl::Math::Cos | ( | DataType | radAngle | ) |
Get the cosine of an angle value.
- Parameters
-
radAngle The angle value in radiants.
- Returns
- The cosine of the angle value.
Referenced by Murl::Math::Cone< DataType >::Cone(), Murl::Math::Matrix< DataType >::GetEulerRotation(), Murl::Math::Quaternion< DataType >::Quaternion(), Murl::Math::Cone< DataType >::Set(), Murl::Math::Matrix< DataType >::SetRotationComponentAxisAngle(), Murl::Math::Matrix< DataType >::SetRotationComponentX(), Murl::Math::Matrix< DataType >::SetRotationComponentXYZ(), Murl::Math::Matrix< DataType >::SetRotationComponentY(), and Murl::Math::Matrix< DataType >::SetRotationComponentZ().
◆ Tan()
DataType Murl::Math::Tan | ( | DataType | radAngle | ) |
Get the tangent of an angle value.
- Parameters
-
radAngle The angle value in radiants.
- Returns
- The tangent of the angle value.
Referenced by Murl::Math::Cone< DataType >::Cone().
◆ ArcSin()
DataType Murl::Math::ArcSin | ( | DataType | value | ) |
Get the arc sine of a value.
- Parameters
-
value The input value.
- Returns
- The arc sine of the value in radiants.
◆ ArcCos()
DataType Murl::Math::ArcCos | ( | DataType | value | ) |
Get the arc cosine of a value.
- Parameters
-
value The input value.
- Returns
- The arc cosine of the value in radiants.
Referenced by Murl::Math::Vector< DataType >::GetAngle2D(), Murl::Math::Quaternion< DataType >::Interpolate(), and Murl::Math::Vector< DataType >::Set().
◆ ArcTan()
DataType Murl::Math::ArcTan | ( | DataType | value | ) |
Get the arc tangent of a value.
- Parameters
-
value The input value.
- Returns
- The arc tangent of the value in radiants.
Referenced by Murl::Math::Cone< DataType >::Set().
◆ ArcTan2()
DataType Murl::Math::ArcTan2 | ( | DataType | y, |
DataType | x | ||
) |
Get the arc tangent of y divided by x.
The function uses the sign of both arguments to determine the quadrant.
- Parameters
-
y The y input value. x The x input value.
- Returns
- The arc tangent of y divided by x in radiants.
Referenced by Murl::Math::Matrix< DataType >::GetEulerRotation().
◆ SinHyp()
DataType Murl::Math::SinHyp | ( | DataType | value | ) |
Get the hyperbolic sine of an value.
- Parameters
-
value The input value.
- Returns
- The hyperbolic sine of the value.
◆ CosHyp()
DataType Murl::Math::CosHyp | ( | DataType | value | ) |
Get the hyperbolic cosine of an value.
- Parameters
-
value The input value.
- Returns
- The hyperbolic cosine of the value.
◆ TanHyp()
DataType Murl::Math::TanHyp | ( | DataType | value | ) |
Get the hyperbolic tangent of an value.
- Parameters
-
value The input value.
- Returns
- The hyperbolic tangent of the value.
◆ ArcSinHyp()
DataType Murl::Math::ArcSinHyp | ( | DataType | value | ) |
Get the hyperbolic arc sine of an value.
- Parameters
-
value The input value.
- Returns
- The hyperbolic arc sine of the value.
◆ ArcCosHyp()
DataType Murl::Math::ArcCosHyp | ( | DataType | value | ) |
Get the hyperbolic arc cosine of an value.
- Parameters
-
value The input value.
- Returns
- The hyperbolic arc cosine of the value.
◆ ArcTanHyp()
DataType Murl::Math::ArcTanHyp | ( | DataType | value | ) |
Get the hyperbolic arc tangent of an value.
- Parameters
-
value The input value.
- Returns
- The hyperbolic arc tangent of the value.
◆ Floor()
DataType Murl::Math::Floor | ( | DataType | value | ) |
Round down to an integral value.
- Parameters
-
value The input value.
- Returns
- The round down integral value.
Referenced by Murl::Math::Round().
◆ Ceil()
DataType Murl::Math::Ceil | ( | DataType | value | ) |
Round up to an integral value.
- Parameters
-
value The input value.
- Returns
- The round up integral value.
Referenced by Murl::Math::Round().
◆ Round()
DataType Murl::Math::Round | ( | DataType | value | ) |
Round to an integral value, regardless of the rounding direction.
Rounding half-way cases away from zero.
- Parameters
-
value The input value.
- Returns
- The rounded integral value.
References Murl::Math::Ceil(), and Murl::Math::Floor().
◆ IsEqual()
Bool Murl::Math::IsEqual | ( | const DataType & | a, |
const DataType & | b, | ||
const DataType & | epsilon = Limits<DataType>::Epsilon() |
||
) |
Check if two values are equal within an epsilon range.
- Parameters
-
a The 1st value. b The 2nd value. epsilon The epsilon value.
- Returns
- true if Abs(a - b) is within epsilon range.
References Murl::Math::Abs().
◆ DegToRad()
DataType Murl::Math::DegToRad | ( | DataType | degrees | ) |
Convert degrees into radiants.
- Parameters
-
degrees The degrees to convert.
- Returns
- The radiants.
References Murl::Math::DEG_TO_RAD.
◆ RadToDeg()
DataType Murl::Math::RadToDeg | ( | DataType | radiants | ) |
Convert radiants into degrees.
- Parameters
-
radiants The radiants to convert.
- Returns
- The degrees.
References Murl::Math::RAD_TO_DEG.
◆ MapAngle()
DataType Murl::Math::MapAngle | ( | DataType | angle | ) |
Map an angle into range [-PI .
. PI).
- Parameters
-
angle The angle value in radiants.
- Returns
- The mapped angle in range [-PI .. PI).
References Murl::Math::Fmod(), Murl::Math::PI, and Murl::Math::TWO_PI.
Referenced by Murl::Math::AddAngle(), and Murl::Math::SubAngle().
◆ AddAngle()
DataType Murl::Math::AddAngle | ( | DataType | angle1, |
DataType | angle2 | ||
) |
Calculate the sum of two angles.
- Parameters
-
angle1 The first angle value in radiants. angle2 The second angle value in radiants.
- Returns
- The result of (angle1 + angle2) in range [-PI .. PI).
References Murl::Math::MapAngle().
◆ SubAngle()
DataType Murl::Math::SubAngle | ( | DataType | angle1, |
DataType | angle2 | ||
) |
Calculate the difference between two angles.
- Parameters
-
angle1 The first angle value in radiants. angle2 The second angle value in radiants.
- Returns
- The result of (angle1 - angle2) in range [-PI .. PI).
References Murl::Math::MapAngle().
◆ FloatToHalfFloat()
Convert a given 32bit float value to 16bit ("half float"), represented by a UInt16 integer.
- Parameters
-
value The 32bit float value to convert
- Returns
- The half float value as an UInt16.
References Murl::Math::Clamp().
Referenced by Murl::Math::IntToHalfFloat().
◆ IntToHalfFloat()
Convert a given 8bit unsigned integer value to a 16bit floating point value ("half float"), represented by a UInt16 integer.
The input value is divided by 255.
- Parameters
-
value The 8bit unsigned integer value to convert
- Returns
- The half float value as an UInt16.
References Murl::Math::FloatToHalfFloat().
◆ HalfFloatToFloat()
Convert a given 16bit half float value stored in a UInt16 to a 32bit float value.
- Parameters
-
value The 16bit float value to convert
- Returns
- The converted 32bit float value
References Murl::Math::Clamp().
Referenced by Murl::Math::HalfFloatToInt().
◆ HalfFloatToInt()
Convert a given 16bit half float value stored in a UInt16 to a 8bit unsigned integer value.
The output value is first clamped to the range [0..1] and then multiplied by 255.
- Parameters
-
value The 16bit float value to convert
- Returns
- The converted 8bit unsigned integer value
References Murl::Math::Clamp(), and Murl::Math::HalfFloatToFloat().
◆ FloatToPackedFloat11()
Convert a given 32bit float value to an 11bit packed float, represented by a UInt16 integer.
- Parameters
-
value The 32bit float value to convert
- Returns
- The packed 11bit float value as an UInt16.
References Murl::Math::Clamp().
◆ PackedFloat11ToFloat()
Convert a given packed 11bit float value stored in a UInt16 to a 32bit float value.
- Parameters
-
value The packed 11bit float value to convert
- Returns
- The converted 32bit float value
References Murl::Math::Clamp().
◆ FloatToPackedFloat10()
Convert a given 32bit float value to an 10bit packed float, represented by a UInt16 integer.
- Parameters
-
value The 32bit float value to convert
- Returns
- The packed 10bit float value as an UInt16.
References Murl::Math::Clamp().
◆ PackedFloat10ToFloat()
Convert a given packed 10bit float value stored in a UInt16 to a 32bit float value.
- Parameters
-
value The packed 10bit float value to convert
- Returns
- The converted 32bit float value
References Murl::Math::Clamp().
◆ Lerp() [1/2]
DataTypeV Murl::Math::Lerp | ( | const DataTypeV & | startValue, |
const DataTypeV & | endValue, | ||
DataTypeT | t | ||
) |
The linear interpolation template function.
- Parameters
-
startValue The start value to interpolate. endValue The end value to interpolate. t The parameter to interpolate in range [0 .. 1].
- Returns
- The interpolation between the inputs startValue and endValue for a parameter t in the closed unit interval [0 .. 1].
Referenced by Murl::Logic::Animation< DataType >::OnEvaluate().
◆ Lerp() [2/2]
Double Murl::Math::Lerp | ( | Double | startValue, |
Double | endValue, | ||
DataTypeT | t | ||
) |
The linear interpolation template function for Double.
- Parameters
-
startValue The start value to interpolate. endValue The end value to interpolate. t The parameter to interpolate in range [0 .. 1].
- Returns
- The interpolation between the inputs startValue and endValue for a parameter t in the closed unit interval [0 .. 1].
◆ GetCubicBezierParameter()
DataTypeT Murl::Math::GetCubicBezierParameter | ( | DataTypeV | x0, |
DataTypeV | x1, | ||
DataTypeV | x2, | ||
DataTypeV | x3, | ||
DataTypeV | x | ||
) |
Get the cubic bezier parameter t for a given X value.
This function interpolates the bezier parameter t (in the range [0..1] for a given target X value and the X values of the four curve control points.
- Parameters
-
x0 The X value of the starting point (first control point) x1 The X value of the second control point x2 The X value of the third control point x3 The X value of the end point (fourth control point) x The target X value
- Returns
- The interpolated curve parameter in the range [0..1].
References Murl::Math::Abs(), and Murl::Math::Clamp().
◆ CubicBezier()
DataTypeV Murl::Math::CubicBezier | ( | DataTypeV | x0, |
DataTypeV | x1, | ||
DataTypeV | x2, | ||
DataTypeV | x3, | ||
DataTypeT | t | ||
) |
Evaluate a cubic bezier curve for a given parameter t.
This function returns the interpolated value of a cubic bezier curve defined via four control points and a given parameter t in the range [0..1].
- Parameters
-
x0 The starting point (first control point) x1 The second control point x2 The third control point x3 The end point (fourth control point) t The curve parameter in the range [0..1]
- Returns
- The interpolated X value.
◆ CubicBezierAt()
DataTypeV Murl::Math::CubicBezierAt | ( | DataTypeV | x0, |
DataTypeV | x1, | ||
DataTypeV | x2, | ||
DataTypeV | x3, | ||
DataTypeV | y0, | ||
DataTypeV | y1, | ||
DataTypeV | y2, | ||
DataTypeV | y3, | ||
DataTypeV | x | ||
) |
Evaluate a cubic bezier curve at a given X value.
This function returns the interpolated Y value of a cubic bezier curve defined via four (X,Y) control point pairs and a given target X value. If the target X value is outside the range [x0..x3], it is clamped to that range.
- Parameters
-
x0 The X value of the starting point (first control point) x1 The X value of the second control point x2 The X value of the third control point x3 The X value of the end point (fourth control point) y0 The Y value of the starting point (first control point) y1 The Y value of the second control point y2 The Y value of the third control point y3 The Y value of the end point (fourth control point) x The target X value
- Returns
- The interpolated Y value
◆ GetEasingFunction()
Easing<DataType>::Interpolate Murl::Math::GetEasingFunction | ( | IEnums::Interpolation | interpolation | ) |
Get the Easing::Interpolate function for a specified interpolation.
- Parameters
-
interpolation The interpolation.
- Returns
- The corresponding Easing::Interpolate function, or Easing::Linear() if the interpolation is invalid.
References Murl::IEnums::INTERPOLATION_CONSTANT, Murl::IEnums::INTERPOLATION_CUBIC_BEZIER, Murl::IEnums::INTERPOLATION_EASE_BACK_IN, Murl::IEnums::INTERPOLATION_EASE_BACK_IN_OUT, Murl::IEnums::INTERPOLATION_EASE_BACK_OUT, Murl::IEnums::INTERPOLATION_EASE_BACK_OUT_IN, Murl::IEnums::INTERPOLATION_EASE_BOUNCE_IN, Murl::IEnums::INTERPOLATION_EASE_BOUNCE_IN_OUT, Murl::IEnums::INTERPOLATION_EASE_BOUNCE_OUT, Murl::IEnums::INTERPOLATION_EASE_BOUNCE_OUT_IN, Murl::IEnums::INTERPOLATION_EASE_CIRCULAR_IN, Murl::IEnums::INTERPOLATION_EASE_CIRCULAR_IN_OUT, Murl::IEnums::INTERPOLATION_EASE_CIRCULAR_OUT, Murl::IEnums::INTERPOLATION_EASE_CIRCULAR_OUT_IN, Murl::IEnums::INTERPOLATION_EASE_ELASTIC_IN, Murl::IEnums::INTERPOLATION_EASE_ELASTIC_IN_OUT, Murl::IEnums::INTERPOLATION_EASE_ELASTIC_OUT, Murl::IEnums::INTERPOLATION_EASE_ELASTIC_OUT_IN, Murl::IEnums::INTERPOLATION_EASE_EXPONENTIAL_IN, Murl::IEnums::INTERPOLATION_EASE_EXPONENTIAL_IN_OUT, Murl::IEnums::INTERPOLATION_EASE_EXPONENTIAL_OUT, Murl::IEnums::INTERPOLATION_EASE_EXPONENTIAL_OUT_IN, Murl::IEnums::INTERPOLATION_EASE_IN, Murl::IEnums::INTERPOLATION_EASE_IN_OUT, Murl::IEnums::INTERPOLATION_EASE_OUT, Murl::IEnums::INTERPOLATION_EASE_OUT_IN, Murl::IEnums::INTERPOLATION_EASE_QUART_IN, Murl::IEnums::INTERPOLATION_EASE_QUART_IN_OUT, Murl::IEnums::INTERPOLATION_EASE_QUART_OUT, Murl::IEnums::INTERPOLATION_EASE_QUART_OUT_IN, Murl::IEnums::INTERPOLATION_LINEAR, Murl::IEnums::INTERPOLATION_SMOOTHERSTEP_IN, Murl::IEnums::INTERPOLATION_SMOOTHERSTEP_IN_OUT, Murl::IEnums::INTERPOLATION_SMOOTHERSTEP_OUT, Murl::IEnums::INTERPOLATION_SMOOTHERSTEP_OUT_IN, Murl::IEnums::INTERPOLATION_SMOOTHSTEP_IN, Murl::IEnums::INTERPOLATION_SMOOTHSTEP_IN_OUT, Murl::IEnums::INTERPOLATION_SMOOTHSTEP_OUT, and Murl::IEnums::INTERPOLATION_SMOOTHSTEP_OUT_IN.
◆ Interpolation()
DataType Murl::Math::Interpolation | ( | IEnums::Interpolation | interpolation, |
DataType | x | ||
) |
The interpolation template function calculates the IEnums::Interpolation curve (easing function).
- Parameters
-
interpolation The interpolation. x The value to interpolate in range [0 .. 1].
- Returns
- The easing function result.
Referenced by Murl::Logic::Animation< DataType >::OnEvaluate(), and Murl::Logic::Animation< DataType >::SetIntermediateKeys().