fix bug #260: broken Qt support for Transform

(transplanted from 84c8b6d5c58c8e09c53356287bdfc8bc730492a0
)
This commit is contained in:
John Tytgat 2011-05-11 22:31:36 +02:00
parent 0c463a21c4
commit 0aa7425f15

View File

@ -672,7 +672,7 @@ Transform<Scalar,Dim,Mode,Options>::Transform(const QMatrix& other)
* *
* This function is available only if the token EIGEN_QT_SUPPORT is defined. * This function is available only if the token EIGEN_QT_SUPPORT is defined.
*/ */
template<typename Scalar, int Dim, int Mode,int Otpions> template<typename Scalar, int Dim, int Mode,int Options>
Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const QMatrix& other) Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const QMatrix& other)
{ {
EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
@ -718,9 +718,13 @@ Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator
{ {
check_template_params(); check_template_params();
EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
m_matrix << other.m11(), other.m21(), other.dx(), if (Mode == int(AffineCompact))
other.m12(), other.m22(), other.dy(), m_matrix << other.m11(), other.m21(), other.dx(),
other.m13(), other.m23(), other.m33(); other.m12(), other.m22(), other.dy();
else
m_matrix << other.m11(), other.m21(), other.dx(),
other.m12(), other.m22(), other.dy(),
other.m13(), other.m23(), other.m33();
return *this; return *this;
} }
@ -732,9 +736,14 @@ template<typename Scalar, int Dim, int Mode, int Options>
QTransform Transform<Scalar,Dim,Mode,Options>::toQTransform(void) const QTransform Transform<Scalar,Dim,Mode,Options>::toQTransform(void) const
{ {
EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
return QTransform(matrix.coeff(0,0), matrix.coeff(1,0), matrix.coeff(2,0) if (Mode == int(AffineCompact))
matrix.coeff(0,1), matrix.coeff(1,1), matrix.coeff(2,1) return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
matrix.coeff(0,2), matrix.coeff(1,2), matrix.coeff(2,2)); m_matrix.coeff(0,1), m_matrix.coeff(1,1),
m_matrix.coeff(0,2), m_matrix.coeff(1,2));
else
return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
} }
#endif #endif