the min/max macros to detect unprotected min/max were undefined by some std header,

so let's declare them after and do the respective fixes ;)
This commit is contained in:
Gael Guennebaud
2011-08-19 14:18:05 +02:00
parent 5734ee6df4
commit 42e2578ef9
29 changed files with 74 additions and 59 deletions

View File

@@ -90,13 +90,13 @@ struct BallPointStuff //this class provides functions to be both an intersector
}
double minimumOnVolume(const BoxType &r) { ++calls; return r.squaredExteriorDistance(p); }
double minimumOnObject(const BallType &b) { ++calls; return std::max(0., (b.center - p).squaredNorm() - SQR(b.radius)); }
double minimumOnObject(const BallType &b) { ++calls; return (std::max)(0., (b.center - p).squaredNorm() - SQR(b.radius)); }
double minimumOnVolumeVolume(const BoxType &r1, const BoxType &r2) { ++calls; return r1.squaredExteriorDistance(r2); }
double minimumOnVolumeObject(const BoxType &r, const BallType &b) { ++calls; return SQR(std::max(0., r.exteriorDistance(b.center) - b.radius)); }
double minimumOnObjectVolume(const BallType &b, const BoxType &r) { ++calls; return SQR(std::max(0., r.exteriorDistance(b.center) - b.radius)); }
double minimumOnObjectObject(const BallType &b1, const BallType &b2){ ++calls; return SQR(std::max(0., (b1.center - b2.center).norm() - b1.radius - b2.radius)); }
double minimumOnVolumeObject(const BoxType &r, const BallType &b) { ++calls; return SQR((std::max)(0., r.exteriorDistance(b.center) - b.radius)); }
double minimumOnObjectVolume(const BallType &b, const BoxType &r) { ++calls; return SQR((std::max)(0., r.exteriorDistance(b.center) - b.radius)); }
double minimumOnObjectObject(const BallType &b1, const BallType &b2){ ++calls; return SQR((std::max)(0., (b1.center - b2.center).norm() - b1.radius - b2.radius)); }
double minimumOnVolumeObject(const BoxType &r, const VectorType &v) { ++calls; return r.squaredExteriorDistance(v); }
double minimumOnObjectObject(const BallType &b, const VectorType &v){ ++calls; return SQR(std::max(0., (b.center - v).norm() - b.radius)); }
double minimumOnObjectObject(const BallType &b, const VectorType &v){ ++calls; return SQR((std::max)(0., (b.center - v).norm() - b.radius)); }
VectorType p;
int calls;

View File

@@ -27,7 +27,7 @@
template<typename Scalar,typename Index> void cg(int size)
{
double density = std::max(8./(size*size), 0.01);
double density = (std::max)(8./(size*size), 0.01);
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
typedef Matrix<Scalar,Dynamic,1> DenseVector;
typedef SparseMatrix<Scalar,ColMajor,Index> SparseMatrixType;

View File

@@ -36,7 +36,7 @@ double binom(int n, int k)
template <typename Derived, typename OtherDerived>
double relerr(const MatrixBase<Derived>& A, const MatrixBase<OtherDerived>& B)
{
return std::sqrt((A - B).cwiseAbs2().sum() / std::min(A.cwiseAbs2().sum(), B.cwiseAbs2().sum()));
return std::sqrt((A - B).cwiseAbs2().sum() / (std::min)(A.cwiseAbs2().sum(), B.cwiseAbs2().sum()));
}
template <typename T>

View File

@@ -67,7 +67,7 @@ template<typename SparseMatrixType> void sparse_extra(const SparseMatrixType& re
typedef typename SparseMatrixType::Scalar Scalar;
enum { Flags = SparseMatrixType::Flags };
double density = std::max(8./(rows*cols), 0.01);
double density = (std::max)(8./(rows*cols), 0.01);
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
typedef Matrix<Scalar,Dynamic,1> DenseVector;
Scalar eps = 1e-6;

View File

@@ -33,7 +33,7 @@ template<typename Scalar,typename Index> void sparse_ldlt(int rows, int cols)
{
static bool odd = true;
odd = !odd;
double density = std::max(8./(rows*cols), 0.01);
double density = (std::max)(8./(rows*cols), 0.01);
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
typedef Matrix<Scalar,Dynamic,1> DenseVector;
typedef SparseMatrix<Scalar,ColMajor,Index> SparseMatrixType;

View File

@@ -31,7 +31,7 @@
template<typename Scalar,typename Index> void sparse_llt(int rows, int cols)
{
double density = std::max(8./(rows*cols), 0.01);
double density = (std::max)(8./(rows*cols), 0.01);
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
typedef Matrix<Scalar,Dynamic,1> DenseVector;
typedef SparseMatrix<Scalar,ColMajor,Index> SparseMatrixType;

View File

@@ -35,7 +35,7 @@
template<typename Scalar> void sparse_lu(int rows, int cols)
{
double density = std::max(8./(rows*cols), 0.01);
double density = (std::max)(8./(rows*cols), 0.01);
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;
typedef Matrix<Scalar,Dynamic,1> DenseVector;