Added Magnitudo Comparer

This commit is contained in:
Paolo Cignoni 2004-02-09 00:27:38 +00:00
parent 2431187e1a
commit 159bd2bf10
1 changed files with 8 additions and 1 deletions

View File

@ -65,6 +65,13 @@ namespace vcg {
static const T MaxVal; static const T MaxVal;
static T ToDeg(const T &a); static T ToDeg(const T &a);
static T ToRad(const T &a); static T ToRad(const T &a);
// Unspecialized members
SCALAR Clamp( const SCALAR & val, const SCALAR& minval, const SCALAR& maxval);
class MagnitudoComparer
{
public:
inline bool operator() ( const T a, const T b ) { return fabs(a)>fabs(b); }
};
}; };
float Math<float>::Sqrt(const float v) float Math<float>::Sqrt(const float v)
@ -93,7 +100,7 @@ namespace vcg {
#endif #endif
template <class SCALAR> template <class SCALAR>
inline SCALAR Clamp( const SCALAR & val, const SCALAR& minval, const SCALAR& maxval) inline SCALAR Math<SCALAR>::Clamp( const SCALAR & val, const SCALAR& minval, const SCALAR& maxval)
{ {
if(val < minval) return minval; if(val < minval) return minval;
if(val > maxval) return maxval; if(val > maxval) return maxval;