aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2011-02-22 08:14:38 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2011-02-22 08:14:38 -0500
commit39d3bc2394d503bd3ca2a53adeae6fa965f4c5a6 (patch)
tree4b84d6d66e741a0e9dedd8ffca1343315c122747
parent659c97ee4961727b28e2a5c072f670c29ebf928e (diff)
fix bug #190: directly pass Transform Options to Matrix, allowing to use RowMajor. Fix issues in Transform with non-default Options.
-rw-r--r--Eigen/src/Geometry/Transform.h16
-rw-r--r--test/geo_transformations.cpp6
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<typename TransformType> 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<Scalar,Rows,HDim,Options&DontAlign> MatrixType;
+ typedef Matrix<Scalar,Rows,HDim,Options> MatrixType;
/** constified MatrixType */
typedef const MatrixType ConstMatrixType;
/** type of the matrix used to represent the linear part of the transformation */
- typedef Matrix<Scalar,Dim,Dim> LinearMatrixType;
+ typedef Matrix<Scalar,Dim,Dim,Options> LinearMatrixType;
/** type of read/write reference to the linear part of the transformation */
typedef Block<MatrixType,Dim,Dim> 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<typename TransformType> struct transform_take_affine_part {
{ return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
};
-template<typename Scalar, int Dim>
-struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact> > {
- typedef typename Transform<Scalar,Dim,AffineCompact>::MatrixType MatrixType;
+template<typename Scalar, int Dim, int Options>
+struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact, Options> > {
+ typedef typename Transform<Scalar,Dim,AffineCompact,Options>::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<Other, Mode,Options,Dim,HDim, HDim,HDim>
template<typename Other, int Options, int Dim, int HDim>
struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HDim,HDim>
{
- static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact> *transform, const Other& other)
+ static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform, const Other& other)
{ transform->matrix() = other.template block<Dim,HDim>(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<double,Projective,AutoAlign>() ));
CALL_SUBTEST_3(( transformations<double,Projective,DontAlign>() ));
CALL_SUBTEST_3(( transform_alignment<double>() ));
+
+ CALL_SUBTEST_4(( transformations<double,Affine,RowMajor|AutoAlign>() ));
+ CALL_SUBTEST_4(( transformations<double,AffineCompact,RowMajor|AutoAlign>() ));
+
+ CALL_SUBTEST_5(( transformations<double,Projective,RowMajor|AutoAlign>() ));
+ CALL_SUBTEST_5(( transformations<double,Projective,RowMajor|DontAlign>() ));
}
}