summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Corrected link issues in qtbaseNico Vertriest2015-09-041-2/+0
| | | | | | Task-number: QTBUG-43810 Change-Id: I0a019becc53b222cb6a7df1fafdccd57aca5b598 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Doc:added doc to undocumented functionsNico Vertriest2015-07-221-6/+0
| | | | | | Task-number: QTBUG-36985 Change-Id: Ic358682b276d67ef804f727bcf14191718613469 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* QQuaternion: optimize op*Marc Mutz2015-05-131-1/+1
| | | | | | | | | | Swap subexpressions around so the expressions involving w (the first member in memory order) execute first. And no, compilers don't do that automatically. Well, GCC 4.9 doesn't. Change-Id: I918ecc27a9ac9775fa91968c0548d182d7ad28e3 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QQuaternion: Deprecate conjugate() and introduce conjugated()Sérgio Martins2015-05-132-5/+23
| | | | | | | | | Change-Id: I9aa835138e1e33448fea920f7a5ba99b26a95ebf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add Q_REQUIRED_RESULT in several placesSérgio Martins2015-05-044-5/+5
| | | | | | Change-Id: Icda3000f1d9f0d41612a50a816aa5de5e32028d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QQuaternion: prepare isNull(), isIdentity() for constexpr'ificationMarc Mutz2015-05-041-2/+2
| | | | | | | | | | | | | | | | | | | ...by dropping the use of qIsNull(), which, in Qt 4, distinguished between -0.0f and +0.0f. But mathematically, whether x, y, z are ±0 doesn't change the fact that the result is the identity element (x, y, z should contain the identity element for addition and w the one for multiplication), or the null element (additive identity). So using qIsNull() was wrong even in Qt 4. In Qt 5, qIsNull() returns true for both ±0, so we can just as well compare to 0.0f instead, which allows to mark these functions constexpr (qIsNull() can't be). Do so. Change-Id: I78b1fa7890036dd3cb4de7f90b75d439f9835e73 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QGenericMatrix: remove one of two non-initializing ctorsMarc Mutz2015-04-261-10/+8
| | | | | | | | | ...and port to the remaining one. Can't do the same for QMatrix4x4, because that class is exported. Change-Id: I5448921af9e9194532be1b9f8d739b5c418a5e0b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QGenericMatrix: remove copy ctorMarc Mutz2015-04-261-9/+0
| | | | | | | | The compiler-generated one is just fine. Change-Id: Iaacc56d4224c69b66823cc64640a00117c44d3cc Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Simplify QQuaternion::operator!=()Marc Mutz2015-04-241-1/+1
| | | | | Change-Id: I5043c86362f5126c52d768b51774086869429e08 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Introduce QQuaternion::fromDirection()Konstantin Ritt2015-04-072-0/+32
| | | | | | | | | | ...which constructs a quaternion using specified forward and upward directions, so that the resulting Z axis "faces" a given forward direction. Change-Id: Ib77b8ab5c359a4880b0d946face87026acdc6f0b Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Michael Krasnyk <michael.krasnyk@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use QDebugStateSaver to restore space setting in stream operators.Friedemann Kleint2015-03-306-6/+12
| | | | | | | | Returning dbg.space() breaks formatting on streams that already have nospace() set. Change-Id: I55e38b018679a67eb40be6b4664505483a3a7d8e Reviewed-by: David Faure <david.faure@kdab.com>
* Fix private member initialization for QMatrix4x4(Qt::Uninitialized)Konstantin Ritt2015-03-161-1/+1
| | | | | | | | ...introduced in 348ac43821ad3b0251d383d82fb02b8ab52ddbeb Change-Id: Iae44cbc5590bfbbaba8c98d838995451fa958105 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Clarify QMatrix4x4::lookAt() docsLaszlo Agocs2015-03-071-4/+7
| | | | | | Task-number: QTBUG-44603 Change-Id: I72d143a5d9ddd31ab1b64788cc0e2dd4fca2531c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Introduce QQuaternion::rotationTo(vecFrom, vecTo)Konstantin Ritt2015-03-072-0/+34
| | | | | | | | | which returns the shortest arc quaternion to rotate vector from to the destination vector to. Change-Id: Ibd7a746789ecdfe6f7fe17e4ac9049f7ac46560d Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* [QQuaternion] Add a way to convert to/from orthonormal axesKonstantin Ritt2015-03-072-2/+54
| | | | | | | | It is just a convenience wrapper around convertion to/from the rotation matrix. Change-Id: I27511b43866827172960b0152f1c7b65da857f6f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Introduce QQuaternion::dotProduct()Konstantin Ritt2015-03-052-17/+27
| | | | | Change-Id: I14b9857ca0a43808b7d536fc258a6bb10f611211 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* Fix QMatrix4x4::lookAt() in case of null directionKonstantin Ritt2015-02-261-1/+5
| | | | | | | | If direction is null, any valid orientation fits, so that the resulting matrix must be valid. Change-Id: Ie8060f44801822ee337b25f75fb275bd02223fe8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Optimize quaternion to rotation matrix convertionKonstantin Ritt2015-02-262-38/+47
| | | | | | | | Rearrange operands to get rid of 50% of multiplications (i.e. `2 * (x * x + z * z)` -> `(x + x) * x + (z + z) * z`). Change-Id: Ib5279425ead999fc571b4964ac1681b6e22f9a7e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [QQuaternion] Add operator* that rotates a vector with a quaternionKonstantin Ritt2015-02-262-0/+17
| | | | | | | | Same as quaternion.rotatedVector(vec). Expression like `vec = quat * vec` quite common in the 3D world. Change-Id: I0edd5a5f80537bd149f03f682b3de15c54463e23 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [QQuaternion] Fix naming of the new methodsKonstantin Ritt2015-02-262-12/+12
| | | | | | | | | | | According to the Qt naming policy, methods that return value(s) via the mutable parameter(s) should have "get" prefix to mention that. [ChangeLog][QtGui][QQuaternion] Added methods to convert a quaternion to/from Euler angles and to/from rotation matrix. Change-Id: I95704e1f4623dc4ca54cd237ea203539fb60d452 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QtGui: Fix some qdoc-warnings.Friedemann Kleint2015-02-252-5/+5
| | | | | | | | | | | | | | qtbase/src/gui/math3d/qquaternion.cpp:466: warning: Undocumented parameter 'eulerAngles' in QQuaternion::fromEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:466: warning: No such parameter 'eulerAngles.y()' in QQuaternion::fromEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:466: warning: No such parameter 'eulerAngles.x()' in QQuaternion::fromEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:466: warning: No such parameter 'eulerAngles.z()' in QQuaternion::fromEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:455: warning: No such parameter 'pitch' in QQuaternion::toEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:455: warning: No such parameter 'roll' in QQuaternion::toEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:455: warning: No such parameter 'yaw' in QQuaternion::toEulerAngles() qtbase/src/gui/opengl/qopenglshaderprogram.cpp:2757: warning: No such parameter 'value' in QOpenGLShaderProgram::setUniformValueArray() Change-Id: Ib825ecb0db798380d97414ca3c3eba8bee3ab6ea Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Use C++ <cmath> instead of <math.h>Allan Sandfeld Jensen2015-02-165-44/+44
| | | | | | | | | | | | | | Including math.h can pollute the default namespace, and break some compilers if cmath versions of the method are declared as using. Switching to C++ math functions also greatly simplifies handling of float qreal as C++ automatically chooses the right method. [ChangeLog][QtCore][QtMath] qmath.h no longer includes math.h, so any sources depending on that indirect inclusion may fail to build. Change-Id: I4d0e331dafba354ec05dc5052e61ef4ff8d387fe Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* [QQuaternion] Introduce to/from euler angles conversion routinesKonstantin Ritt2015-02-142-0/+144
| | | | | Change-Id: I26c0a9d1ce9258048cf44eed5b5238920c2317b1 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* [QQuaternion] Introduce toAxisAndAngle()Konstantin Ritt2015-02-142-0/+59
| | | | | | | | | This operation is the exact opposite to QQuaternion::fromAxisAndAngle() (so that it is a way to extract the axis and angle values suitable to create the same quaternion via QQuaternion::fromAxisAndAngle()). Change-Id: I41fda58f5fb2b867cccd6b2faf58ab671fa070da Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-1112-84/+84
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* [QQuaternion] Introduce to/from rotation matrix conversion routinesKonstantin Ritt2015-02-062-0/+89
| | | | | | Change-Id: Ic19824e7e135f53a9ce3f2ea7ecd078a589e7425 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [QMath3D] Add public c-tors that do not initialize the contentsKonstantin Ritt2015-02-0412-0/+54
| | | | | | Change-Id: I1a28766451e6750986a239c989e7f30c14479057 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Introduce QMatrix4x4::isAffine()Konstantin Ritt2015-01-282-0/+19
| | | | | | | | - a convenience method thats checks if the matrix has no projective coefficients. Change-Id: Ieea8ac2e4237b471a683ad5010672b1e89a0c953 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Introduce QQuaternion::inverted()Konstantin Ritt2015-01-282-0/+24
| | | | | Change-Id: I6de77082bb7c32e48fb7f7d765a58fdbe68db1fd Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [QVectorND] Add missing operator/=(const QVectorND &)Konstantin Ritt2015-01-286-0/+108
| | | | | Change-Id: Ic1d2912808b95e02ba5d9cb2972c81c6374bbca9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add project/unproject methods in QVector3DPaul Lemire2015-01-222-0/+69
| | | | | | | | | | Equivalent of gluProject and gluUnproject. [ChangeLog][QtCore][QVector3D] add convenience project and unproject methods to use like gluProject and gluUnproject Change-Id: I6e4e3e79ea6e34d1fb0c375e15185c950b699ef0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-2412-228/+132
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Add viewport transform to QMatrix4x4Sean Harmer2014-05-162-0/+53
| | | | | | | | | | | | | This allows to easily create a matrix that performs the transformation used by OpenGL fixed function to go from normalized device coordinates to window coordinates. This comes in useful if you need to perform the NDC->window coordinate conversion inside a shader. Change-Id: I183b3545bfb3eb1e8b13fc3172911b46926fcbb7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Revert some previously added constexpr in QVector?d classesAlex Blasche2014-03-106-43/+7
| | | | | | | | | | | | | | This commit partly reverts cd91d8ad0281c984a01b8091696a6fdfdfa69514. The revert is required as the used ifdef relied on undefined compiler behavior. Especially Windows has had trouble. The revert reduces the risk of breaks by future compilers. The proper inline and constexpr has to wait until Qt 6. Task-number: QTBUG-37122 Change-Id: I881fffb95fa46d9c170c9420a578f15640e18aea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QVector* compile on Win/staticAlex Blasche2014-03-086-3/+11
| | | | | | Task-number: QTBUG-37122 Change-Id: Ib2283e8c27da7af2bdc08eee3b7cc542fbe55d71 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Convert more QVector*D member functions to constexprAlex Blasche2013-11-203-3/+31
| | | | | | | | | | constexpr requires inline functions. We convert more member functions to inline functions while retaining a version of those functions inside QtGui. This prevents any BC breakage. Change-Id: I325b78da6b41611bda3994869f474c700b6fb306 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add C++11 constexpr to 3D vector classesAlex Blasche2013-11-153-114/+114
| | | | | | | | | This turns QVector2D(1,1) into compile-time expressions when using a C++11 compiler. Change-Id: Ifea2d1cdfd5481300f9a5a0c7bbe8bfe9115c636 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-086-29/+29
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Add operator[] to QVectorND classesSean Harmer2013-08-276-0/+102
| | | | | | Change-Id: Ia786d4fab64da974bb60f24c05325925d42a1e70 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Doc: Corrected a typo in the constructor documentation.Venu2013-03-271-1/+1
| | | | | | | | | Task-number: QTBUG-30162 Change-Id: I2db9ae7b5bab82cf4b65dc35bcb904ffbfb9e115 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* Add convenience distance methods to QVector2DLaszlo Papp2013-03-182-0/+36
| | | | | | Change-Id: I8ecdda35912a95e69c2f8dd98ce9c41c77b222d2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Add a minor convenience for calculating the distance to a pointLaszlo Papp2013-03-152-0/+14
| | | | | Change-Id: I312727bf6858ead6c30fe20bf3abc5afc73a3a14 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-296-24/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Fix a typo and make the QQuaternion constructor documentation even more explicitLaszlo Papp2013-01-251-2/+3
| | | | | Change-Id: I913ef98b706f29f1bab7564d6d6fff0a91ebfdc0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-1812-12/+12
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make the documentation more explicit an talkativeLaszlo Papp2012-12-072-8/+10
| | | | | | Change-Id: Ifa4b7c3c5f8ec384addbb80a9436d55b32d8bc51 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* WINCE: Fix missing cosfAndreas Holzammer2012-12-032-0/+4
| | | | | | | | | cosf seems to be defined in the cmath header for Windows CE, so include it to fix the issue of not finding the symbol cosf. Change-Id: I7317668838912325d45be0d4087ae3055940d3cd Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove last usages of qSin and friends from QQuaternionSean Harmer2012-11-261-6/+6
| | | | | Change-Id: I93fe1d22313da4cfa671603ccdbe9ac8f02cd73b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-2212-288/+288
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Remove temporary constructor used to make qreal->float changeSean Harmer2012-09-092-12/+0
| | | | | | | | | | | | The constructor being removed was needed to allow the CI to work until commit e88f56afc2c889eede8c719b9ce7b621f49a96f9 in qtdeclarative was merged. This completes the move from qreal->float in QtGui/math3d. Change-Id: I2afd108bd9398a1e6925b2885a90dbbad4d25669 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>