diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-10-25 23:26:53 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-10-25 23:26:53 (GMT) |
commit | cbb1b29d397c063fc3bcae04c5b062f20cbd12c5 (patch) | |
tree | d89cebe45c9f6dfdcab34a95da19ee0d670e30f5 /src/gui/math3d | |
parent | ed7d58f6668be4ffb5f915722dee81c864f74844 (diff) | |
parent | 9aa00de1d277763c0f7a380fde27face60e5f686 (diff) | |
download | Qt-cbb1b29d397c063fc3bcae04c5b062f20cbd12c5.zip Qt-cbb1b29d397c063fc3bcae04c5b062f20cbd12c5.tar.gz Qt-cbb1b29d397c063fc3bcae04c5b062f20cbd12c5.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts:
tools/qdoc3/cppcodemarker.cpp
Diffstat (limited to 'src/gui/math3d')
-rw-r--r-- | src/gui/math3d/qmatrix4x4.cpp | 22 | ||||
-rw-r--r-- | src/gui/math3d/qmatrix4x4.h | 3 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index ed1b13d..00e8f15 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -1430,6 +1430,24 @@ QMatrix QMatrix4x4::toAffine() const m[3][0], m[3][1]); } +/*! + Returns the conventional Qt 2D transformation matrix that + corresponds to this matrix. + + The returned QTransform is formed by simply dropping the + third row and third column of the QMatrix4x4. This is suitable + for implementing orthographic projections where the z co-ordinate + should be dropped rather than projected. + + \sa toAffine() +*/ +QTransform QMatrix4x4::toTransform() const +{ + return QTransform(m[0][0], m[0][1], m[0][3], + m[1][0], m[1][1], m[1][3], + m[3][0], m[3][1], m[3][3]); +} + static const qreal inv_dist_to_plane = 1. / 1024.; /*! @@ -1437,8 +1455,8 @@ static const qreal inv_dist_to_plane = 1. / 1024.; corresponds to this matrix. If \a distanceToPlane is non-zero, it indicates a projection - factor to use to adjust for the z co-ordinate. The default - value of 1024 corresponds to the projection factor used + factor to use to adjust for the z co-ordinate. The value of + 1024 corresponds to the projection factor used by QTransform::rotate() for the x and y axes. If \a distanceToPlane is zero, then the returned QTransform diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index b32e00a..42d992e 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -159,7 +159,8 @@ public: void toValueArray(qreal *values) const; QMatrix toAffine() const; - QTransform toTransform(qreal distanceToPlane = 1024.0f) const; + QTransform toTransform() const; + QTransform toTransform(qreal distanceToPlane) const; QPoint map(const QPoint& point) const; QPointF map(const QPointF& point) const; |