Utility::Value::Clamp

This commit is contained in:
Dander7BD 2014-01-20 18:46:08 +01:00
parent 28fbcebf98
commit 2ec8662a83
1 changed files with 4 additions and 0 deletions

View File

@ -327,6 +327,10 @@ namespace Utility
inline ValueType Min( const ValueType &valueA, const ValueType &valueB ) inline ValueType Min( const ValueType &valueA, const ValueType &valueB )
{ return valueA < valueB ? valueA : valueB; } { return valueA < valueB ? valueA : valueB; }
template<typename ValueType>
inline ValueType Clamp( const ValueType &value, const ValueType &min, const ValueType &max )
{ return value < min ? Max( value, max ) : min; }
template<typename ValueType> template<typename ValueType>
inline ValueType Average( const ValueType &valueA, const ValueType &valueB ) inline ValueType Average( const ValueType &valueA, const ValueType &valueB )
{ return (valueA + valueB) * 0.5f; } { return (valueA + valueB) * 0.5f; }