diff --git a/vcg/math/base.h b/vcg/math/base.h index 7f6f9cc4..9b45edd9 100644 --- a/vcg/math/base.h +++ b/vcg/math/base.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.16 2004/05/03 08:38:08 ganovelli +correction on templates + Revision 1.15 2004/04/15 09:36:59 ganovelli Min and Max changed from const members to static class function Use: Value::Min() @@ -110,70 +113,13 @@ namespace math { inline double Asin(const double v) { return asin(v); } inline double Atan2(const double v0,const double v1) { return atan2(v0,v1); } - - /// max and min values for each scalar type - /// syntax: Max::Value - - template class Value { - public: const SCALAR Min; const SCALAR Max; - }; - template <> - class Value { public: static const char Min(){static char v=-128; return v;} - static const char Max(){static char v=+127; return v;} - }; - - template <> - class Value { public: static const unsigned char Min(){static unsigned char v=0; return v;} - static const unsigned char Max(){static unsigned char v=255; return v;} - }; - template <> - class Value { public: static const short Min(){static short v=(-32767 -1); return v;} - static const short Max(){static short v=+32767; return v;} - }; - template <> - class Value { public: static const unsigned short Min(){static unsigned short v=0; return v;} - static const unsigned short Max(){static unsigned short v=65535; return v;} - }; - template <> - class Value { public: static const int Min(){static int v=(-2147483647 - 1); return v;} - static const int Max(){static int v= +2147483647; return v;} - }; - template <> - class Value { public: static const unsigned int Min(){static unsigned int v=0; return v;} - static const unsigned int Max(){static unsigned int v=4294967295; return v;} - }; - template <> - class Value<__int64 > { public: static const __int64 Min(){static __int64 v=(-9223372036854775807i64 - 1); return v;} - static const __int64 Max(){static __int64 v= +9223372036854775807i64; return v;} - }; - template <> - class Value { public: static const long Min(){static long v=(-2147483647L -1L); return v;} - static const long Max(){static long v= +2147483647L; return v;} - }; - template <> - class Value { public: static const unsigned long Min(){static unsigned long v=0; return v;} - static const unsigned long Max(){static unsigned long v=4294967295; return v;} - }; - template <> - class Value { public: static const float Min(){static float v=-3.4E38F; return v;} - static const float Max(){static float v=+3.4E38F; return v;} - }; - template <> - class Value { public: static const double Min(){static double v=-1.7E308; return v;} - static const double Max(){static double v=+1.7E308; return v;} - }; - template <> - class Value { public: static const long double Min(){static long double v=-1.7E308; return v;} //-1.2E4931 ? - static const long double Max(){static long double v=+1.7E308; return v;}//+1.2E4931 ? - }; - - template inline const T & Min(const T &a, const T &b){ if (a inline const T & Max(const T &a, const T &b){ if (a inline void Swap(T &a, T &b){ T tmp=a; a=b; b=tmp; };