Murl::Math Functions

Mathematic functions (Trigonometric, exponential, rounding, etc.). More...

Collaboration diagram for Murl::Math Functions:

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()

◆ Sgn()

template<class DataType >
DataType Murl::Math::Sgn ( DataType  value)

Get the sign of a value.

Parameters
valueThe 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]

template<class DataType >
const DataType& Murl::Math::Min ( const DataType &  x,
const DataType &  y 
)

◆ Min() [2/3]

template<class DataType >
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
xThe 1st value.
yThe 2nd value.
zThe 3rd value.
Returns
The lowest value of x, y and z.

References Murl::Math::Min().

◆ Min() [3/3]

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.

If all are equivalent, x is returned.

Parameters
xThe 1st value.
yThe 2nd value.
zThe 3rd value.
wThe 4th value.
Returns
The lowest value of x, y, z and w.

References Murl::Math::Min().

◆ Max() [1/3]

◆ Max() [2/3]

template<class DataType >
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
xThe 1st value.
yThe 2nd value.
zThe 3rd value.
Returns
The highest value of x, y and z.

References Murl::Math::Max().

◆ Max() [3/3]

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.

If all are equivalent, x is returned.

Parameters
xThe 1st value.
yThe 2nd value.
zThe 3rd value.
wThe 4th value.
Returns
The highest value of x, y, z and w.

References Murl::Math::Max().

◆ Clamp()

template<class DataType >
const DataType& Murl::Math::Clamp ( const DataType &  val,
const DataType &  min,
const DataType &  max 
)

◆ IsNaN()

template<class DataType >
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
valueThe value to check.
Returns
true if the value is not a number (NaN).

◆ IsInfinite()

template<class DataType >
Bool Murl::Math::IsInfinite ( DataType  value)

Check if a value is infinite (either positive infinity or negative infinity).

Parameters
valueThe value to check.
Returns
true if the value is an infinity value.

◆ IsFinite()

template<class DataType >
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
valueThe value to check.
Returns
true if the value is finite.

◆ Exp()

template<class DataType >
DataType Murl::Math::Exp ( DataType  value)

Get the the e number raised to the power of a value.

Parameters
valueThe input value.
Returns
The the e number raised to the power of the value.

Referenced by Murl::Util::GaussianFilter::Apply().

◆ Log()

template<class DataType >
DataType Murl::Math::Log ( DataType  value)

Get the natural logarithm of a value.

Parameters
valueThe input value.
Returns
The natural logarithm of the value.

◆ Log2()

template<class DataType >
DataType Murl::Math::Log2 ( DataType  value)

Get the base 2 logarithm of a value.

Parameters
valueThe input value.
Returns
The base 2 logarithm of the value.

◆ Log10()

template<class DataType >
DataType Murl::Math::Log10 ( DataType  value)

Get the base 10 logarithm of a value.

Parameters
valueThe input value.
Returns
The base 10 logarithm of the value.

◆ Sqrt()

◆ Pow()

template<class DataType >
DataType Murl::Math::Pow ( DataType  base,
DataType  exponent 
)

Get a base raised to the power of an exponent.

Parameters
baseThe base input value.
exponentThe 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()

template<class DataType >
DataType Murl::Math::Fmod ( DataType  numerator,
DataType  denominator 
)

Get the remainder of a numerator divided by a denominator.

Parameters
numeratorThe numerator input value.
denominatorThe 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()

template<class DataType >
DataType Murl::Math::ModF ( DataType  value,
DataType &  intPart 
)

Get the integer part and the fractional part of a value.

Parameters
valueThe input value.
intPartThe integer part return value.
Returns
The fractional part of the value.

◆ Remainder()

template<class DataType >
DataType Murl::Math::Remainder ( DataType  numerator,
DataType  denominator 
)

Get the IEEE remainder of a numerator divided by a denominator.

Parameters
numeratorThe numerator input value.
denominatorThe denominator input value.
Returns
The IEEE remainder of the numerator divided by the denominator.

◆ Sin()

◆ Cos()

◆ Tan()

template<class DataType >
DataType Murl::Math::Tan ( DataType  radAngle)

Get the tangent of an angle value.

Parameters
radAngleThe angle value in radiants.
Returns
The tangent of the angle value.

Referenced by Murl::Math::Cone< DataType >::Cone().

◆ ArcSin()

template<class DataType >
DataType Murl::Math::ArcSin ( DataType  value)

Get the arc sine of a value.

Parameters
valueThe input value.
Returns
The arc sine of the value in radiants.

◆ ArcCos()

template<class DataType >
DataType Murl::Math::ArcCos ( DataType  value)

Get the arc cosine of a value.

Parameters
valueThe 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()

template<class DataType >
DataType Murl::Math::ArcTan ( DataType  value)

Get the arc tangent of a value.

Parameters
valueThe input value.
Returns
The arc tangent of the value in radiants.

Referenced by Murl::Math::Cone< DataType >::Set().

◆ ArcTan2()

template<class DataType >
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
yThe y input value.
xThe x input value.
Returns
The arc tangent of y divided by x in radiants.

Referenced by Murl::Math::Matrix< DataType >::GetEulerRotation().

◆ SinHyp()

template<class DataType >
DataType Murl::Math::SinHyp ( DataType  value)

Get the hyperbolic sine of an value.

Parameters
valueThe input value.
Returns
The hyperbolic sine of the value.

◆ CosHyp()

template<class DataType >
DataType Murl::Math::CosHyp ( DataType  value)

Get the hyperbolic cosine of an value.

Parameters
valueThe input value.
Returns
The hyperbolic cosine of the value.

◆ TanHyp()

template<class DataType >
DataType Murl::Math::TanHyp ( DataType  value)

Get the hyperbolic tangent of an value.

Parameters
valueThe input value.
Returns
The hyperbolic tangent of the value.

◆ ArcSinHyp()

template<class DataType >
DataType Murl::Math::ArcSinHyp ( DataType  value)

Get the hyperbolic arc sine of an value.

Parameters
valueThe input value.
Returns
The hyperbolic arc sine of the value.

◆ ArcCosHyp()

template<class DataType >
DataType Murl::Math::ArcCosHyp ( DataType  value)

Get the hyperbolic arc cosine of an value.

Parameters
valueThe input value.
Returns
The hyperbolic arc cosine of the value.

◆ ArcTanHyp()

template<class DataType >
DataType Murl::Math::ArcTanHyp ( DataType  value)

Get the hyperbolic arc tangent of an value.

Parameters
valueThe input value.
Returns
The hyperbolic arc tangent of the value.

◆ Floor()

template<class DataType >
DataType Murl::Math::Floor ( DataType  value)

Round down to an integral value.

Parameters
valueThe input value.
Returns
The round down integral value.

Referenced by Murl::Math::Round().

◆ Ceil()

template<class DataType >
DataType Murl::Math::Ceil ( DataType  value)

Round up to an integral value.

Parameters
valueThe input value.
Returns
The round up integral value.

Referenced by Murl::Math::Round().

◆ Round()

template<class DataType >
DataType Murl::Math::Round ( DataType  value)

Round to an integral value, regardless of the rounding direction.

Rounding half-way cases away from zero.

Parameters
valueThe input value.
Returns
The rounded integral value.

References Murl::Math::Ceil(), and Murl::Math::Floor().

◆ IsEqual()

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.

Parameters
aThe 1st value.
bThe 2nd value.
epsilonThe epsilon value.
Returns
true if Abs(a - b) is within epsilon range.

References Murl::Math::Abs().

◆ DegToRad()

template<class DataType >
DataType Murl::Math::DegToRad ( DataType  degrees)

Convert degrees into radiants.

Parameters
degreesThe degrees to convert.
Returns
The radiants.

References Murl::Math::DEG_TO_RAD.

◆ RadToDeg()

template<class DataType >
DataType Murl::Math::RadToDeg ( DataType  radiants)

Convert radiants into degrees.

Parameters
radiantsThe radiants to convert.
Returns
The degrees.

References Murl::Math::RAD_TO_DEG.

◆ MapAngle()

template<class DataType >
DataType Murl::Math::MapAngle ( DataType  angle)

Map an angle into range [-PI .

. PI).

Parameters
angleThe 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()

template<class DataType >
DataType Murl::Math::AddAngle ( DataType  angle1,
DataType  angle2 
)

Calculate the sum of two angles.

Parameters
angle1The first angle value in radiants.
angle2The second angle value in radiants.
Returns
The result of (angle1 + angle2) in range [-PI .. PI).

References Murl::Math::MapAngle().

◆ SubAngle()

template<class DataType >
DataType Murl::Math::SubAngle ( DataType  angle1,
DataType  angle2 
)

Calculate the difference between two angles.

Parameters
angle1The first angle value in radiants.
angle2The second angle value in radiants.
Returns
The result of (angle1 - angle2) in range [-PI .. PI).

References Murl::Math::MapAngle().

◆ FloatToHalfFloat()

UInt16 Murl::Math::FloatToHalfFloat ( Float  value)
inline

Convert a given 32bit float value to 16bit ("half float"), represented by a UInt16 integer.

Parameters
valueThe 32bit float value to convert
Returns
The half float value as an UInt16.

References Murl::Math::Clamp().

Referenced by Murl::Math::IntToHalfFloat().

◆ IntToHalfFloat()

UInt16 Murl::Math::IntToHalfFloat ( UInt8  value)
inline

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
valueThe 8bit unsigned integer value to convert
Returns
The half float value as an UInt16.

References Murl::Math::FloatToHalfFloat().

◆ HalfFloatToFloat()

Float Murl::Math::HalfFloatToFloat ( UInt16  value)
inline

Convert a given 16bit half float value stored in a UInt16 to a 32bit float value.

Parameters
valueThe 16bit float value to convert
Returns
The converted 32bit float value

References Murl::Math::Clamp().

Referenced by Murl::Math::HalfFloatToInt().

◆ HalfFloatToInt()

UInt8 Murl::Math::HalfFloatToInt ( UInt16  value)
inline

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
valueThe 16bit float value to convert
Returns
The converted 8bit unsigned integer value

References Murl::Math::Clamp(), and Murl::Math::HalfFloatToFloat().

◆ FloatToPackedFloat11()

UInt16 Murl::Math::FloatToPackedFloat11 ( Float  value)
inline

Convert a given 32bit float value to an 11bit packed float, represented by a UInt16 integer.

Parameters
valueThe 32bit float value to convert
Returns
The packed 11bit float value as an UInt16.

References Murl::Math::Clamp().

◆ PackedFloat11ToFloat()

Float Murl::Math::PackedFloat11ToFloat ( UInt16  value)
inline

Convert a given packed 11bit float value stored in a UInt16 to a 32bit float value.

Parameters
valueThe packed 11bit float value to convert
Returns
The converted 32bit float value

References Murl::Math::Clamp().

◆ FloatToPackedFloat10()

UInt16 Murl::Math::FloatToPackedFloat10 ( Float  value)
inline

Convert a given 32bit float value to an 10bit packed float, represented by a UInt16 integer.

Parameters
valueThe 32bit float value to convert
Returns
The packed 10bit float value as an UInt16.

References Murl::Math::Clamp().

◆ PackedFloat10ToFloat()

Float Murl::Math::PackedFloat10ToFloat ( UInt16  value)
inline

Convert a given packed 10bit float value stored in a UInt16 to a 32bit float value.

Parameters
valueThe packed 10bit float value to convert
Returns
The converted 32bit float value

References Murl::Math::Clamp().

◆ Lerp() [1/2]

template<class DataTypeV , class DataTypeT >
DataTypeV Murl::Math::Lerp ( const DataTypeV &  startValue,
const DataTypeV &  endValue,
DataTypeT  t 
)

The linear interpolation template function.

Parameters
startValueThe start value to interpolate.
endValueThe end value to interpolate.
tThe 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]

template<class DataTypeT >
Double Murl::Math::Lerp ( Double  startValue,
Double  endValue,
DataTypeT  t 
)

The linear interpolation template function for Double.

Parameters
startValueThe start value to interpolate.
endValueThe end value to interpolate.
tThe 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()

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.

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
x0The X value of the starting point (first control point)
x1The X value of the second control point
x2The X value of the third control point
x3The X value of the end point (fourth control point)
xThe target X value
Returns
The interpolated curve parameter in the range [0..1].

References Murl::Math::Abs(), and Murl::Math::Clamp().

◆ CubicBezier()

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.

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
x0The starting point (first control point)
x1The second control point
x2The third control point
x3The end point (fourth control point)
tThe curve parameter in the range [0..1]
Returns
The interpolated X value.

◆ CubicBezierAt()

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.

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
x0The X value of the starting point (first control point)
x1The X value of the second control point
x2The X value of the third control point
x3The X value of the end point (fourth control point)
y0The Y value of the starting point (first control point)
y1The Y value of the second control point
y2The Y value of the third control point
y3The Y value of the end point (fourth control point)
xThe target X value
Returns
The interpolated Y value

◆ GetEasingFunction()

template<class DataType >
Easing<DataType>::Interpolate Murl::Math::GetEasingFunction ( IEnums::Interpolation  interpolation)

Get the Easing::Interpolate function for a specified interpolation.

Parameters
interpolationThe 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()

template<class DataType >
DataType Murl::Math::Interpolation ( IEnums::Interpolation  interpolation,
DataType  x 
)

The interpolation template function calculates the IEnums::Interpolation curve (easing function).

Parameters
interpolationThe interpolation.
xThe 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().


Copyright © 2011-2024 Spraylight GmbH.