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

Function Documentation#

template<u32 L, typename T>
constexpr Vec<L, T> TRAP::Math::Clamp(const Vec<L, T> &x, T minVal, T maxVal)#

Constrain x to lie between minVal and maxVal.

Parameters:
  • x – Specify the value to constrain.

  • minVal – Specify the lower end of the range into which to constrain x.

  • maxVal – Specify the upper end of the range into which to constrain x.

Returns:

Min(Max(x, minval), maxVal) for each component in x using the floating-point values minval and maxVal.