Bugfix in the Qt's QTransform and QMatrix support in Geometry/Transform.h

Function 'Transform<Scalar,Dim>::toQMatrix(void) const' :
  - 'other' was a hasty copy/paste to be replaced my m_matrix
	- 'coeffRef' was incorect for const Transform

Function 'Transform<Scalar,Dim>::toQTransform(void) const' :
	- return type was incorrect 'QMatrix' to be replaced by 'QTransform'
	- same bigfixes as in the previous point
This commit is contained in:
Anthony Truchet 2009-07-30 10:09:41 +02:00
parent f5a167b3e7
commit 8eab0bccbf

View File

@ -335,9 +335,9 @@ template<typename Scalar, int Dim>
QMatrix Transform<Scalar,Dim>::toQMatrix(void) const QMatrix Transform<Scalar,Dim>::toQMatrix(void) const
{ {
EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE) EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
return QMatrix(other.coeffRef(0,0), other.coeffRef(1,0), return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
other.coeffRef(0,1), other.coeffRef(1,1), m_matrix.coeff(0,1), m_matrix.coeff(1,1),
other.coeffRef(0,2), other.coeffRef(1,2)); m_matrix.coeff(0,2), m_matrix.coeff(1,2));
} }
/** Initialises \c *this from a QTransform assuming the dimension is 2. /** Initialises \c *this from a QTransform assuming the dimension is 2.
@ -369,12 +369,12 @@ Transform<Scalar,Dim>& Transform<Scalar,Dim>::operator=(const QTransform& 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> template<typename Scalar, int Dim>
QMatrix Transform<Scalar,Dim>::toQTransform(void) const QTransform Transform<Scalar,Dim>::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(other.coeffRef(0,0), other.coeffRef(1,0), other.coeffRef(2,0) return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
other.coeffRef(0,1), other.coeffRef(1,1), other.coeffRef(2,1) m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
other.coeffRef(0,2), other.coeffRef(1,2), other.coeffRef(2,2); m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
} }
#endif #endif