From d8bfd151d115428d5577a90fcab2c1b7191093bf Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 30 Jul 2009 16:05:38 +0200 Subject: [PATCH 1/5] forward-port Anthony Truchet's changeset 8eab0bccbf8b1969f32bb006b61d2137f6f37ead --- Eigen/src/Geometry/Transform.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index c186e5ec4..9edd31152 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -537,9 +537,9 @@ template QMatrix Transform::toQMatrix(void) const { EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) - return QMatrix(other.coeffRef(0,0), other.coeffRef(1,0), - other.coeffRef(0,1), other.coeffRef(1,1), - other.coeffRef(0,2), other.coeffRef(1,2)); + return QMatrix(matrix.coeff(0,0), matrix.coeff(1,0), + matrix.coeff(0,1), matrix.coeff(1,1), + matrix.coeff(0,2), matrix.coeff(1,2)); } /** Initialises \c *this from a QTransform assuming the dimension is 2. @@ -571,12 +571,12 @@ Transform& Transform::operator=(const QTransfo * This function is available only if the token EIGEN_QT_SUPPORT is defined. */ template -QMatrix Transform::toQTransform(void) const +QTransform Transform::toQTransform(void) const { EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) - return QTransform(other.coeffRef(0,0), other.coeffRef(1,0), other.coeffRef(2,0) - other.coeffRef(0,1), other.coeffRef(1,1), other.coeffRef(2,1) - other.coeffRef(0,2), other.coeffRef(1,2), other.coeffRef(2,2); + return QTransform(matrix.coeff(0,0), matrix.coeff(1,0), matrix.coeff(2,0) + matrix.coeff(0,1), matrix.coeff(1,1), matrix.coeff(2,1) + matrix.coeff(0,2), matrix.coeff(1,2), matrix.coeff(2,2); } #endif From 2e9f7f80bf76cc2e7f11a3fcca5f71e635be81ed Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 31 Jul 2009 10:04:34 +0200 Subject: [PATCH 2/5] compilation fixes for sun CC --- Eigen/src/Geometry/Homogeneous.h | 6 ++-- Eigen/src/Geometry/RotationBase.h | 49 ++++++++++++++++--------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/Eigen/src/Geometry/Homogeneous.h b/Eigen/src/Geometry/Homogeneous.h index 530725d90..5f4cddcea 100644 --- a/Eigen/src/Geometry/Homogeneous.h +++ b/Eigen/src/Geometry/Homogeneous.h @@ -62,11 +62,13 @@ struct ei_traits > template struct ei_homogeneous_left_product_impl; template struct ei_homogeneous_right_product_impl; -template class Homogeneous - : public MatrixBase > +template class Homogeneous + : public MatrixBase > { public: + enum { Direction = _Direction }; + EIGEN_GENERIC_PUBLIC_INTERFACE(Homogeneous) inline Homogeneous(const MatrixType& matrix) diff --git a/Eigen/src/Geometry/RotationBase.h b/Eigen/src/Geometry/RotationBase.h index 632ea3991..7a4307ee7 100644 --- a/Eigen/src/Geometry/RotationBase.h +++ b/Eigen/src/Geometry/RotationBase.h @@ -25,8 +25,9 @@ #ifndef EIGEN_ROTATIONBASE_H #define EIGEN_ROTATIONBASE_H -// this file aims to contains the various representations of rotation/orientation -// in 2D and 3D space excepted Matrix and Quaternion. +// forward declaration +template +struct ei_rotation_base_generic_product_selector; /** \class RotationBase * @@ -47,25 +48,6 @@ class RotationBase typedef Matrix RotationMatrixType; typedef Matrix VectorType; - protected: - template - struct generic_product_selector - { - typedef RotationMatrixType ReturnType; - inline static RotationMatrixType run(const Derived& r, const MatrixType& m) - { return r.toRotationMatrix() * m; } - }; - - template - struct generic_product_selector - { - typedef VectorType ReturnType; - inline static VectorType run(const Derived& r, const OtherVectorType& v) - { - return r._transformVector(v); - } - }; - public: inline const Derived& derived() const { return *static_cast(this); } inline Derived& derived() { return *static_cast(this); } @@ -90,9 +72,9 @@ class RotationBase * - a vector of size Dim */ template - inline typename generic_product_selector::ReturnType + inline typename ei_rotation_base_generic_product_selector::ReturnType operator*(const MatrixBase& e) const - { return generic_product_selector::run(derived(), e.derived()); } + { return ei_rotation_base_generic_product_selector::run(derived(), e.derived()); } /** \returns the concatenation of a linear transformation \a l with the rotation \a r */ template friend @@ -109,6 +91,27 @@ class RotationBase { return toRotationMatrix() * v; } }; +// implementation of the generic product rotation * matrix +template +struct ei_rotation_base_generic_product_selector +{ + enum { Dim = RotationDerived::Dim }; + typedef Matrix ReturnType; + inline static ReturnType run(const RotationDerived& r, const MatrixType& m) + { return r.toRotationMatrix() * m; } +}; + +template +struct ei_rotation_base_generic_product_selector +{ + enum { Dim = RotationDerived::Dim }; + typedef Matrix ReturnType; + inline static ReturnType run(const RotationDerived& r, const OtherVectorType& v) + { + return r._transformVector(v); + } +}; + /** \geometry_module * * Constructs a Dim x Dim rotation matrix from the rotation \a r From ae5e26a363d9d611cbfd3683a0c7845683e6c99d Mon Sep 17 00:00:00 2001 From: Manuel Yguel Date: Fri, 31 Jul 2009 09:21:31 +0200 Subject: [PATCH 3/5] add missing ei_atan2 without painfull warnings --- Eigen/src/Core/MathFunctions.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 3527042f9..4d0d0f0b8 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -63,6 +63,7 @@ inline int ei_exp(int) { ei_assert(false); return 0; } inline int ei_log(int) { ei_assert(false); return 0; } inline int ei_sin(int) { ei_assert(false); return 0; } inline int ei_cos(int) { ei_assert(false); return 0; } +inline int ei_atan2( int , int ) { ei_assert(false); return 0; } inline int ei_pow(int x, int y) { int res = 1; @@ -117,6 +118,7 @@ inline float ei_exp(float x) { return std::exp(x); } inline float ei_log(float x) { return std::log(x); } inline float ei_sin(float x) { return std::sin(x); } inline float ei_cos(float x) { return std::cos(x); } +inline float ei_atan2( float y, float x ) { return std::atan2(y,x); } inline float ei_pow(float x, float y) { return std::pow(x, y); } template<> inline float ei_random(float a, float b) @@ -165,6 +167,7 @@ inline double ei_exp(double x) { return std::exp(x); } inline double ei_log(double x) { return std::log(x); } inline double ei_sin(double x) { return std::sin(x); } inline double ei_cos(double x) { return std::cos(x); } +inline double ei_atan2( double y, double x ) { return std::atan2(y,x); } inline double ei_pow(double x, double y) { return std::pow(x, y); } template<> inline double ei_random(double a, double b) @@ -211,6 +214,7 @@ inline float ei_abs2(const std::complex& x) { return std::norm(x); } inline std::complex ei_exp(std::complex x) { return std::exp(x); } inline std::complex ei_sin(std::complex x) { return std::sin(x); } inline std::complex ei_cos(std::complex x) { return std::cos(x); } +inline std::complex ei_atan2(std::complex , std::complex ) { ei_assert(false); return 0; } template<> inline std::complex ei_random() { @@ -247,6 +251,7 @@ inline double ei_abs2(const std::complex& x) { return std::norm(x); } inline std::complex ei_exp(std::complex x) { return std::exp(x); } inline std::complex ei_sin(std::complex x) { return std::sin(x); } inline std::complex ei_cos(std::complex x) { return std::cos(x); } +inline std::complex ei_atan2(std::complex , std::complex ) { ei_assert(false); return 0; } template<> inline std::complex ei_random() { @@ -285,6 +290,7 @@ inline long double ei_exp(long double x) { return std::exp(x); } inline long double ei_log(long double x) { return std::log(x); } inline long double ei_sin(long double x) { return std::sin(x); } inline long double ei_cos(long double x) { return std::cos(x); } +inline long double ei_atan2( long double y, long double x ) { return std::atan2(y,x); } inline long double ei_pow(long double x, long double y) { return std::pow(x, y); } template<> inline long double ei_random(long double a, long double b) From 21f686846bcda8997444090f779f78e17a801604 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 31 Jul 2009 10:08:23 +0200 Subject: [PATCH 4/5] s/std::atan2/ei_atan2 --- Eigen/src/Core/MathFunctions.h | 12 ++++++------ Eigen/src/Geometry/EulerAngles.h | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 4d0d0f0b8..d68c483b2 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -63,7 +63,7 @@ inline int ei_exp(int) { ei_assert(false); return 0; } inline int ei_log(int) { ei_assert(false); return 0; } inline int ei_sin(int) { ei_assert(false); return 0; } inline int ei_cos(int) { ei_assert(false); return 0; } -inline int ei_atan2( int , int ) { ei_assert(false); return 0; } +inline int ei_atan2(int, int) { ei_assert(false); return 0; } inline int ei_pow(int x, int y) { int res = 1; @@ -118,7 +118,7 @@ inline float ei_exp(float x) { return std::exp(x); } inline float ei_log(float x) { return std::log(x); } inline float ei_sin(float x) { return std::sin(x); } inline float ei_cos(float x) { return std::cos(x); } -inline float ei_atan2( float y, float x ) { return std::atan2(y,x); } +inline float ei_atan2(float y, float x) { return std::atan2(y,x); } inline float ei_pow(float x, float y) { return std::pow(x, y); } template<> inline float ei_random(float a, float b) @@ -167,7 +167,7 @@ inline double ei_exp(double x) { return std::exp(x); } inline double ei_log(double x) { return std::log(x); } inline double ei_sin(double x) { return std::sin(x); } inline double ei_cos(double x) { return std::cos(x); } -inline double ei_atan2( double y, double x ) { return std::atan2(y,x); } +inline double ei_atan2(double y, double x) { return std::atan2(y,x); } inline double ei_pow(double x, double y) { return std::pow(x, y); } template<> inline double ei_random(double a, double b) @@ -214,7 +214,7 @@ inline float ei_abs2(const std::complex& x) { return std::norm(x); } inline std::complex ei_exp(std::complex x) { return std::exp(x); } inline std::complex ei_sin(std::complex x) { return std::sin(x); } inline std::complex ei_cos(std::complex x) { return std::cos(x); } -inline std::complex ei_atan2(std::complex , std::complex ) { ei_assert(false); return 0; } +inline std::complex ei_atan2(std::complex, std::complex ) { ei_assert(false); return 0; } template<> inline std::complex ei_random() { @@ -251,7 +251,7 @@ inline double ei_abs2(const std::complex& x) { return std::norm(x); } inline std::complex ei_exp(std::complex x) { return std::exp(x); } inline std::complex ei_sin(std::complex x) { return std::sin(x); } inline std::complex ei_cos(std::complex x) { return std::cos(x); } -inline std::complex ei_atan2(std::complex , std::complex ) { ei_assert(false); return 0; } +inline std::complex ei_atan2(std::complex, std::complex) { ei_assert(false); return 0; } template<> inline std::complex ei_random() { @@ -290,7 +290,7 @@ inline long double ei_exp(long double x) { return std::exp(x); } inline long double ei_log(long double x) { return std::log(x); } inline long double ei_sin(long double x) { return std::sin(x); } inline long double ei_cos(long double x) { return std::cos(x); } -inline long double ei_atan2( long double y, long double x ) { return std::atan2(y,x); } +inline long double ei_atan2(long double y, long double x) { return std::atan2(y,x); } inline long double ei_pow(long double x, long double y) { return std::pow(x, y); } template<> inline long double ei_random(long double a, long double b) diff --git a/Eigen/src/Geometry/EulerAngles.h b/Eigen/src/Geometry/EulerAngles.h index 97a892222..dbcc7ae89 100644 --- a/Eigen/src/Geometry/EulerAngles.h +++ b/Eigen/src/Geometry/EulerAngles.h @@ -60,31 +60,31 @@ MatrixBase::eulerAngles(int a0, int a1, int a2) const if (a0==a2) { Scalar s = Vector2(coeff(j,i) , coeff(k,i)).norm(); - res[1] = std::atan2(s, coeff(i,i)); + res[1] = ei_atan2(s, coeff(i,i)); if (s > epsilon) { - res[0] = std::atan2(coeff(j,i), coeff(k,i)); - res[2] = std::atan2(coeff(i,j),-coeff(i,k)); + res[0] = ei_atan2(coeff(j,i), coeff(k,i)); + res[2] = ei_atan2(coeff(i,j),-coeff(i,k)); } else { res[0] = Scalar(0); - res[2] = (coeff(i,i)>0?1:-1)*std::atan2(-coeff(k,j), coeff(j,j)); + res[2] = (coeff(i,i)>0?1:-1)*ei_atan2(-coeff(k,j), coeff(j,j)); } } else { Scalar c = Vector2(coeff(i,i) , coeff(i,j)).norm(); - res[1] = std::atan2(-coeff(i,k), c); + res[1] = ei_atan2(-coeff(i,k), c); if (c > epsilon) { - res[0] = std::atan2(coeff(j,k), coeff(k,k)); - res[2] = std::atan2(coeff(i,j), coeff(i,i)); + res[0] = ei_atan2(coeff(j,k), coeff(k,k)); + res[2] = ei_atan2(coeff(i,j), coeff(i,i)); } else { res[0] = Scalar(0); - res[2] = (coeff(i,k)>0?1:-1)*std::atan2(-coeff(k,j), coeff(j,j)); + res[2] = (coeff(i,k)>0?1:-1)*ei_atan2(-coeff(k,j), coeff(j,j)); } } if (!odd) From cd4978014397cb58b66da7c4f73a09879789d2e2 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sun, 2 Aug 2009 15:09:34 +0200 Subject: [PATCH 5/5] apply patch from Marcus Hanwell: Improved quoting of tests when added to the build --- cmake/EigenTesting.cmake | 2 +- test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake index 571774787..ef36d2067 100644 --- a/cmake/EigenTesting.cmake +++ b/cmake/EigenTesting.cmake @@ -74,7 +74,7 @@ macro(ei_add_test testname) string(STRIP "${ARGV2}" ARGV2_stripped) string(LENGTH "${ARGV2_stripped}" ARGV2_stripped_length) if(${ARGV2_stripped_length} GREATER 0) - target_link_libraries(${targetname} ${ARGV2}) + target_link_libraries(${targetname} "${ARGV2}") endif(${ARGV2_stripped_length} GREATER 0) endif(${ARGC} GREATER 2) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a266ec482..1e2bd5a9a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -133,7 +133,7 @@ if(QT4_FOUND) else(QT_QTCORE_LIBRARY_DEBUG) set(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY_RELEASE}) endif(QT_QTCORE_LIBRARY_DEBUG) - ei_add_test(qtvector " " ${QT_QTCORE_LIBRARY}) + ei_add_test(qtvector " " "${QT_QTCORE_LIBRARY}") endif(QT4_FOUND) ei_add_test(sparse_vector) ei_add_test(sparse_basic)