summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/math3d')
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp2
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp22
-rw-r--r--src/gui/math3d/qquaternion.cpp1
-rw-r--r--src/gui/math3d/qvector2d.cpp2
-rw-r--r--src/gui/math3d/qvector3d.cpp1
-rw-r--r--src/gui/math3d/qvector4d.cpp1
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.