Commit 0f9d7dcb authored by Jan Möbius's avatar Jan Möbius
Browse files

Replaced fabs by the std methods to fix errors when using norms with double vectors

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@775 fdac6126-5c0c-442c-9429-916003d36597
parent ac94d92a
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <OpenMesh/Core/System/config.h> #include <OpenMesh/Core/System/config.h>
#include <iostream> #include <iostream>
#include <cmath>
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
...@@ -300,6 +301,8 @@ typedef VectorT<unsigned int,3> Vec3ui; ...@@ -300,6 +301,8 @@ typedef VectorT<unsigned int,3> Vec3ui;
typedef VectorT<float,3> Vec3f; typedef VectorT<float,3> Vec3f;
/** 3-double vector */ /** 3-double vector */
typedef VectorT<double,3> Vec3d; typedef VectorT<double,3> Vec3d;
/** 3-bool vector */
typedef VectorT<bool,3> Vec3b;
/** 4-byte signed vector */ /** 4-byte signed vector */
typedef VectorT<signed char,4> Vec4c; typedef VectorT<signed char,4> Vec4c;
......
...@@ -458,12 +458,12 @@ public: ...@@ -458,12 +458,12 @@ public:
{ {
#if DIM==N #if DIM==N
Scalar s(0); Scalar s(0);
#define expr(i) s += abs(Base::values_[i]); #define expr(i) s += std::abs(Base::values_[i]);
unroll(expr); unroll(expr);
#undef expr #undef expr
return s; return s;
#else #else
#define expr(i) abs(Base::values_[i]) #define expr(i) std::abs(Base::values_[i])
return (unroll_comb(expr, +)); return (unroll_comb(expr, +));
#undef expr #undef expr
#endif #endif
...@@ -493,10 +493,10 @@ public: ...@@ -493,10 +493,10 @@ public:
/// return the maximal absolute component /// return the maximal absolute component
inline Scalar max_abs() const inline Scalar max_abs() const
{ {
Scalar m(abs(Base::values_[0])); Scalar m(std::abs(Base::values_[0]));
for(int i=1; i<DIM; ++i) for(int i=1; i<DIM; ++i)
if(abs(Base::values_[i])>m) if(std::abs(Base::values_[i])>m)
m=abs(Base::values_[i]); m=std::abs(Base::values_[i]);
return m; return m;
} }
...@@ -512,10 +512,10 @@ public: ...@@ -512,10 +512,10 @@ public:
/// return the minimal absolute component /// return the minimal absolute component
inline Scalar min_abs() const inline Scalar min_abs() const
{ {
Scalar m(abs(Base::values_[0])); Scalar m(std::abs(Base::values_[0]));
for(int i=1; i<DIM; ++i) for(int i=1; i<DIM; ++i)
if(abs(Base::values_[i])<m) if(std::abs(Base::values_[i])<m)
m=abs(Base::values_[i]); m=std::abs(Base::values_[i]);
return m; return m;
} }
...@@ -528,8 +528,8 @@ public: ...@@ -528,8 +528,8 @@ public:
/// return absolute arithmetic mean /// return absolute arithmetic mean
inline Scalar mean_abs() const { inline Scalar mean_abs() const {
Scalar m(abs(Base::values_[0])); Scalar m(std::abs(Base::values_[0]));
for(int i=1; i<DIM; ++i) m+=abs(Base::values_[i]); for(int i=1; i<DIM; ++i) m+=std::abs(Base::values_[i]);
return m/Scalar(DIM); return m/Scalar(DIM);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment