diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-18 06:34:18 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-18 06:34:18 (GMT) |
commit | fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf (patch) | |
tree | aa2ba4ce64d047d73c29ab0616e8a89d352c3abd /src/gui/math3d | |
parent | d24029e3d4639f1300e7a68858936911df969f69 (diff) | |
parent | 572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173 (diff) | |
download | Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.zip Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.tar.gz Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.tar.bz2 |
Merge commit 'qt/master'
Conflicts:
doc/src/examples.qdoc
doc/src/plugins-howto.qdoc
doc/src/topics.qdoc
examples/phonon/musicplayer/mainwindow.cpp
src/3rdparty/freetype/src/base/ftobjs.c
src/corelib/global/qglobal.h
src/corelib/tools/qalgorithms.h
src/corelib/tools/qshareddata.cpp
src/corelib/tools/qsharedpointer.cpp
src/corelib/tools/tools.pri
src/corelib/xml/qxmlstream.h
src/gui/painting/painting.pri
src/gui/widgets/qdatetimeedit.cpp
tests/auto/qdesktopservices/qdesktopservices.pro
tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
tests/auto/qtextcodec/test/test.pro
Diffstat (limited to 'src/gui/math3d')
-rw-r--r-- | src/gui/math3d/qgenericmatrix.cpp | 2 | ||||
-rw-r--r-- | src/gui/math3d/qmatrix4x4.cpp | 22 | ||||
-rw-r--r-- | src/gui/math3d/qquaternion.cpp | 1 | ||||
-rw-r--r-- | src/gui/math3d/qvector2d.cpp | 2 | ||||
-rw-r--r-- | src/gui/math3d/qvector3d.cpp | 1 | ||||
-rw-r--r-- | src/gui/math3d/qvector4d.cpp | 1 |
6 files changed, 25 insertions, 4 deletions
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp index 271571c..1c924c7 100644 --- a/src/gui/math3d/qgenericmatrix.cpp +++ b/src/gui/math3d/qgenericmatrix.cpp @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE \class QGenericMatrix \brief The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows. \since 4.6 + \ingroup painting + \ingroup painting-3D The QGenericMatrix template has four parameters: 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) { diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 9e56966..b2c598f 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE \class QQuaternion \brief The QQuaternion class represents a quaternion consisting of a vector and scalar. \since 4.6 + \ingroup painting-3D Quaternions are used to represent rotations in 3D space, and consist of a 3D rotation axis specified by the x, y, and z diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index f7fef6c..1662020 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE \class QVector2D \brief The QVector2D class represents a vector or vertex in 2D space. \since 4.6 + \ingroup painting + \ingroup painting-3D The QVector2D class can also be used to represent vertices in 2D space. We therefore do not need to provide a separate vertex class. diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 2915d3a..0e3f4e1 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE \class QVector3D \brief The QVector3D class represents a vector or vertex in 3D space. \since 4.6 + \ingroup painting-3D Vectors are one of the main building blocks of 3D representation and drawing. They consist of three coordinates, traditionally called diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index dd64103..a2efff7 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE \class QVector4D \brief The QVector4D class represents a vector or vertex in 4D space. \since 4.6 + \ingroup painting-3D The QVector4D class can also be used to represent vertices in 4D space. We therefore do not need to provide a separate vertex class. |