From 159bd2bf101be9713c2d26f43a5aaae619c37e3a Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 9 Feb 2004 00:27:38 +0000 Subject: [PATCH] Added Magnitudo Comparer --- vcg/math/Base.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vcg/math/Base.h b/vcg/math/Base.h index 7a5942ab..de4af488 100644 --- a/vcg/math/Base.h +++ b/vcg/math/Base.h @@ -65,6 +65,13 @@ namespace vcg { static const T MaxVal; static T ToDeg(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::Sqrt(const float v) @@ -93,7 +100,7 @@ namespace vcg { #endif template -inline SCALAR Clamp( const SCALAR & val, const SCALAR& minval, const SCALAR& maxval) +inline SCALAR Math::Clamp( const SCALAR & val, const SCALAR& minval, const SCALAR& maxval) { if(val < minval) return minval; if(val > maxval) return maxval;