diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-02-26 17:46:14 +0400 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-03-05 10:46:07 +0000 |
commit | a5d5353b59ab7eb41d37048064f46490f98a228a (patch) | |
tree | 4783dfbb5b98c6acf87d28985cdb2d1042bc083e /src/gui/math3d/qquaternion.h | |
parent | 6c973dee2cb1686ea32657fff7dced3e611b98ce (diff) | |
download | qtbase-a5d5353b59ab7eb41d37048064f46490f98a228a.tar.gz |
Introduce QQuaternion::dotProduct()
Change-Id: I14b9857ca0a43808b7d536fc258a6bb10f611211
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/gui/math3d/qquaternion.h')
-rw-r--r-- | src/gui/math3d/qquaternion.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index a02c37ce1d..b4022e8579 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -78,6 +78,8 @@ public: void setZ(float z); void setScalar(float scalar); + Q_DECL_CONSTEXPR static inline float dotProduct(const QQuaternion &q1, const QQuaternion &q2); + float length() const; float lengthSquared() const; @@ -168,6 +170,11 @@ inline void QQuaternion::setY(float aY) { yp = aY; } inline void QQuaternion::setZ(float aZ) { zp = aZ; } inline void QQuaternion::setScalar(float aScalar) { wp = aScalar; } +Q_DECL_CONSTEXPR inline float QQuaternion::dotProduct(const QQuaternion &q1, const QQuaternion &q2) +{ + return q1.xp * q2.xp + q1.yp * q2.yp + q1.zp * q2.zp + q1.wp * q2.wp; +} + inline QQuaternion QQuaternion::inverted() const { // Need some extra precision if the length is very small. |