Template Function TRAP::Math::SmoothStep(genType, genType, genType)#

Function Documentation#

template<typename genType>
constexpr genType TRAP::Math::SmoothStep(genType edge0, genType edge1, genType x)#

Perform Hermite interpolation between 0 and 1 when edge0 < x < edge1.

This is useful in cases where you would want a threshold function with a smooth transition. This is equivalent to: genType t; t = Clamp((x - edge0) / (edge1 - edge0), 0, 1); return t * t * (3 - 2 * t);

Note

Results are undefined if edge0 >= edge1!

Parameters:
  • edge0 – Specifies the value of the lower edge of the Hermite function.

  • edge1 – Specifies the value of the upper edge of the Hermite function.

  • x – Specifies the source value for interpolation.

Returns:

0.0 if x <= edge0 and 1.0 if x >= edge1 and performs smooth Hermite interpolation between 0 and 1 when edge0 < x < edge1.