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

Function Documentation#

template<typename genType>
constexpr genType TRAP::Math::Clamp(genType x, genType minVal, genType 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.