Template Function TRAP::Math::SmoothStep(const Vec<L, T>&, const Vec<L, T>&, const Vec<L, T>&)#

Function Documentation#

template<u32 L, typename T>
constexpr Vec<L, T> TRAP::Math::SmoothStep(const Vec<L, T> &edge0, const Vec<L, T> &edge1, const Vec<L, T> &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.