MorphoGraphX
Namespaces | Functions
Clamp.hpp File Reference

Defines the util::clamp function. More...

#include <Config.hpp>

Go to the source code of this file.

Namespaces

 mgx
 This namespace contains all the API of MorphoGraphX.
 

Functions

template<class T >
T mgx::util::clamp (const T &val, const T &min, const T &max)
 A function to clamp a value to a range. More...
 

Detailed Description

Defines the util::clamp function.

Function Documentation

template<class T >
T mgx::util::clamp ( const T &  val,
const T &  min,
const T &  max 
)

A function to clamp a value to a range.

Parameters
valThe start value.
minThe minimum value of the range.
maxThe maximum value of the range.

If min is more than max, the function returns max.