From 39d3bc2394d503bd3ca2a53adeae6fa965f4c5a6 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Tue, 22 Feb 2011 08:14:38 -0500 Subject: [PATCH] fix bug #190: directly pass Transform Options to Matrix, allowing to use RowMajor. Fix issues in Transform with non-default Options. --- Eigen/src/Geometry/Transform.h | 16 ++++++++-------- test/geo_transformations.cpp | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index d1986db9c..f3256687b 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -89,7 +89,8 @@ template struct transform_take_affine_part; * - AffineCompact: the transformation is stored as a (Dim)x(Dim+1) matrix. * - Projective: the transformation is stored as a (Dim+1)^2 matrix * without any assumption. - * \tparam _Options can be \b AutoAlign or \b DontAlign. Default is \b AutoAlign + * \tparam _Options has the same meaning as in class Matrix. It allows to specify DontAlign and/or RowMajor. + * These Options are passed directly to the underlying matrix type. * * The homography is internally represented and stored by a matrix which * is available through the matrix() method. To understand the behavior of @@ -198,11 +199,11 @@ public: typedef _Scalar Scalar; typedef DenseIndex Index; /** type of the matrix used to represent the transformation */ - typedef Matrix MatrixType; + typedef Matrix MatrixType; /** constified MatrixType */ typedef const MatrixType ConstMatrixType; /** type of the matrix used to represent the linear part of the transformation */ - typedef Matrix LinearMatrixType; + typedef Matrix LinearMatrixType; /** type of read/write reference to the linear part of the transformation */ typedef Block LinearPart; /** type of read reference to the linear part of the transformation */ @@ -607,7 +608,6 @@ protected: #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_STRONG_INLINE static void check_template_params() { - EIGEN_STATIC_ASSERT((Options & (DontAlign)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS) } #endif @@ -1139,9 +1139,9 @@ template struct transform_take_affine_part { { return m.template block(0,0); } }; -template -struct transform_take_affine_part > { - typedef typename Transform::MatrixType MatrixType; +template +struct transform_take_affine_part > { + typedef typename Transform::MatrixType MatrixType; static inline MatrixType& run(MatrixType& m) { return m; } static inline const MatrixType& run(const MatrixType& m) { return m; } }; @@ -1181,7 +1181,7 @@ struct transform_construct_from_matrix template struct transform_construct_from_matrix { - static inline void run(Transform *transform, const Other& other) + static inline void run(Transform *transform, const Other& other) { transform->matrix() = other.template block(0,0); } }; diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp index 005a02f71..44ce1f501 100644 --- a/test/geo_transformations.cpp +++ b/test/geo_transformations.cpp @@ -459,5 +459,11 @@ void test_geo_transformations() CALL_SUBTEST_3(( transformations() )); CALL_SUBTEST_3(( transformations() )); CALL_SUBTEST_3(( transform_alignment() )); + + CALL_SUBTEST_4(( transformations() )); + CALL_SUBTEST_4(( transformations() )); + + CALL_SUBTEST_5(( transformations() )); + CALL_SUBTEST_5(( transformations() )); } }