diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 3527042f9..d68c483b2 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) 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) 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 98d68c294..b129b706b 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 - operator*(const MultiplierBase& e) const - { return generic_product_selector::run(derived(), e.derived()); } + inline typename ei_rotation_base_generic_product_selector::ReturnType + operator*(const MatrixBase& e) const + { 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 diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index eb6048c47..b1f3de301 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 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 9c65b9c51..f3c477374 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -142,7 +142,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)