Implemented an osg::minimum and osg::maximum template functions to replace

the std::min/max functions previously used in parts of the osg, since the
std::min/max methods do not seem implemented under IRIX.
This commit is contained in:
Robert Osfield
2003-02-24 12:02:00 +00:00
parent 372ca1d227
commit 7877c55770
3 changed files with 18 additions and 11 deletions

View File

@@ -108,6 +108,16 @@ const double PI = 3.14159265358979323846;
const double PI_2 = 1.57079632679489661923;
const double PI_4 = 0.78539816339744830962;
/** return the minimum of two values, equivilant to std::min.
* std::min not used because of STL implementation under IRIX contains no std::min.*/
template<typename T>
inline T minimum(T lhs,T rhs) { return lhs<rhs?lhs:rhs; }
/** return the maximum of two values, equivilant to std::max.
* std::max not used because of STL implementation under IRIX contains no std::max.*/
template<typename T>
inline T maximum(T lhs,T rhs) { return lhs>rhs?lhs:rhs; }
template<typename T>
inline T clampTo(T v,T minimum,T maximum) { return v<minimum?minimum:v>maximum?maximum:v; }