mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-01 16:24:28 +08:00
fix bug #190: directly pass Transform Options to Matrix, allowing to use RowMajor. Fix issues in Transform with non-default Options.
This commit is contained in:
parent
659c97ee49
commit
39d3bc2394
@ -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); }
|
||||
};
|
||||
|
||||
|
@ -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>() ));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user