summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d/qmatrix4x4.cpp
diff options
context:
space:
mode:
authorJanne Koskinen <janne.p.koskinen@digia.com>2009-08-18 14:44:21 (GMT)
committerJanne Koskinen <janne.p.koskinen@digia.com>2009-08-18 14:44:21 (GMT)
commit3d6056dfe01116e34a2b47a70fb95e73753ef766 (patch)
treeee4e1430dc9f0b06ab89091682d5a60525eac560 /src/gui/math3d/qmatrix4x4.cpp
parent52e469a629d32b7f7e52518874dab13fcd4bb814 (diff)
parent69689f3527f373618a1f4adad543b60afea46c17 (diff)
downloadQt-3d6056dfe01116e34a2b47a70fb95e73753ef766.zip
Qt-3d6056dfe01116e34a2b47a70fb95e73753ef766.tar.gz
Qt-3d6056dfe01116e34a2b47a70fb95e73753ef766.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'src/gui/math3d/qmatrix4x4.cpp')
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index a67a832..8fc439b 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
\class QMatrix4x4
\brief The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
\since 4.6
+ \ingroup painting-3D
\sa QVector3D, QGenericMatrix
*/
@@ -1009,11 +1010,24 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector)
*/
QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z)
{
+ if (angle == 0.0f)
+ return *this;
QMatrix4x4 m(1); // The "1" says to not load the identity.
- qreal a = angle * M_PI / 180.0f;
- qreal c = qCos(a);
- qreal s = qSin(a);
- qreal ic;
+ qreal c, s, ic;
+ if (angle == 90.0f || angle == -270.0f) {
+ s = 1.0f;
+ c = 0.0f;
+ } else if (angle == -90.0f || angle == 270.0f) {
+ s = -1.0f;
+ c = 0.0f;
+ } else if (angle == 180.0f || angle == -180.0f) {
+ s = 0.0f;
+ c = -1.0f;
+ } else {
+ qreal a = angle * M_PI / 180.0f;
+ c = qCos(a);
+ s = qSin(a);
+ }
bool quick = false;
if (x == 0.0f) {
if (y == 0.0f) {