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 @@
#include <OpenMesh/Core/System/config.h>
#include <iostream>
#include <cmath>
#include <assert.h>
#include <math.h>
#include <string.h>
......@@ -300,6 +301,8 @@ typedef VectorT<unsigned int,3> Vec3ui;
typedef VectorT<float,3> Vec3f;
/** 3-double vector */
typedef VectorT<double,3> Vec3d;
/** 3-bool vector */
typedef VectorT<bool,3> Vec3b;
/** 4-byte signed vector */
typedef VectorT<signed char,4> Vec4c;
......
......@@ -458,12 +458,12 @@ public:
{
#if DIM==N
Scalar s(0);
#define expr(i) s += abs(Base::values_[i]);
#define expr(i) s += std::abs(Base::values_[i]);
unroll(expr);
#undef expr
return s;
#else
#define expr(i) abs(Base::values_[i])
#define expr(i) std::abs(Base::values_[i])
return (unroll_comb(expr, +));
#undef expr
#endif
......@@ -493,10 +493,10 @@ public:
/// return the maximal absolute component
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)
if(abs(Base::values_[i])>m)
m=abs(Base::values_[i]);
if(std::abs(Base::values_[i])>m)
m=std::abs(Base::values_[i]);
return m;
}
......@@ -512,10 +512,10 @@ public:
/// return the minimal absolute component
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)
if(abs(Base::values_[i])<m)
m=abs(Base::values_[i]);
if(std::abs(Base::values_[i])<m)
m=std::abs(Base::values_[i]);
return m;
}
......@@ -528,8 +528,8 @@ public:
/// return absolute arithmetic mean
inline Scalar mean_abs() const {
Scalar m(abs(Base::values_[0]));
for(int i=1; i<DIM; ++i) m+=abs(Base::values_[i]);
Scalar m(std::abs(Base::values_[0]));
for(int i=1; i<DIM; ++i) m+=std::abs(Base::values_[i]);
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