summaryrefslogtreecommitdiff
path: root/src/gui/math3d/qquaternion.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/math3d/qquaternion.h')
-rw-r--r--src/gui/math3d/qquaternion.h96
1 files changed, 48 insertions, 48 deletions
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 0a1552f045..2188a08fc9 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -59,9 +59,9 @@ class Q_GUI_EXPORT QQuaternion
{
public:
QQuaternion();
- QQuaternion(qreal scalar, qreal xpos, qreal ypos, qreal zpos);
+ QQuaternion(float scalar, float xpos, float ypos, float zpos);
#ifndef QT_NO_VECTOR3D
- QQuaternion(qreal scalar, const QVector3D& vector);
+ QQuaternion(float scalar, const QVector3D& vector);
#endif
#ifndef QT_NO_VECTOR4D
explicit QQuaternion(const QVector4D& vector);
@@ -74,20 +74,20 @@ public:
QVector3D vector() const;
void setVector(const QVector3D& vector);
#endif
- void setVector(qreal x, qreal y, qreal z);
+ void setVector(float x, float y, float z);
- qreal x() const;
- qreal y() const;
- qreal z() const;
- qreal scalar() const;
+ float x() const;
+ float y() const;
+ float z() const;
+ float scalar() const;
- void setX(qreal x);
- void setY(qreal y);
- void setZ(qreal z);
- void setScalar(qreal scalar);
+ void setX(float x);
+ void setY(float y);
+ void setZ(float z);
+ void setScalar(float scalar);
- qreal length() const;
- qreal lengthSquared() const;
+ float length() const;
+ float lengthSquared() const;
QQuaternion normalized() const;
void normalize();
@@ -98,19 +98,19 @@ public:
QQuaternion &operator+=(const QQuaternion &quaternion);
QQuaternion &operator-=(const QQuaternion &quaternion);
- QQuaternion &operator*=(qreal factor);
+ QQuaternion &operator*=(float factor);
QQuaternion &operator*=(const QQuaternion &quaternion);
- QQuaternion &operator/=(qreal divisor);
+ QQuaternion &operator/=(float divisor);
friend inline bool operator==(const QQuaternion &q1, const QQuaternion &q2);
friend inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2);
friend inline const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2);
friend inline const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2);
- friend inline const QQuaternion operator*(qreal factor, const QQuaternion &quaternion);
- friend inline const QQuaternion operator*(const QQuaternion &quaternion, qreal factor);
+ friend inline const QQuaternion operator*(float factor, const QQuaternion &quaternion);
+ friend inline const QQuaternion operator*(const QQuaternion &quaternion, float factor);
friend inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2);
friend inline const QQuaternion operator-(const QQuaternion &quaternion);
- friend inline const QQuaternion operator/(const QQuaternion &quaternion, qreal divisor);
+ friend inline const QQuaternion operator/(const QQuaternion &quaternion, float divisor);
friend inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2);
@@ -121,25 +121,25 @@ public:
operator QVariant() const;
#ifndef QT_NO_VECTOR3D
- static QQuaternion fromAxisAndAngle(const QVector3D& axis, qreal angle);
+ static QQuaternion fromAxisAndAngle(const QVector3D& axis, float angle);
#endif
static QQuaternion fromAxisAndAngle
- (qreal x, qreal y, qreal z, qreal angle);
+ (float x, float y, float z, float angle);
static QQuaternion slerp
- (const QQuaternion& q1, const QQuaternion& q2, qreal t);
+ (const QQuaternion& q1, const QQuaternion& q2, float t);
static QQuaternion nlerp
- (const QQuaternion& q1, const QQuaternion& q2, qreal t);
+ (const QQuaternion& q1, const QQuaternion& q2, float t);
private:
- qreal wp, xp, yp, zp;
+ float wp, xp, yp, zp;
};
Q_DECLARE_TYPEINFO(QQuaternion, Q_MOVABLE_TYPE);
inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {}
-inline QQuaternion::QQuaternion(qreal aScalar, qreal xpos, qreal ypos, qreal zpos) : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {}
+inline QQuaternion::QQuaternion(float aScalar, float xpos, float ypos, float zpos) : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {}
inline bool QQuaternion::isNull() const
@@ -152,15 +152,15 @@ inline bool QQuaternion::isIdentity() const
return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && wp == 1.0f;
}
-inline qreal QQuaternion::x() const { return qreal(xp); }
-inline qreal QQuaternion::y() const { return qreal(yp); }
-inline qreal QQuaternion::z() const { return qreal(zp); }
-inline qreal QQuaternion::scalar() const { return qreal(wp); }
+inline float QQuaternion::x() const { return xp; }
+inline float QQuaternion::y() const { return yp; }
+inline float QQuaternion::z() const { return zp; }
+inline float QQuaternion::scalar() const { return wp; }
-inline void QQuaternion::setX(qreal aX) { xp = aX; }
-inline void QQuaternion::setY(qreal aY) { yp = aY; }
-inline void QQuaternion::setZ(qreal aZ) { zp = aZ; }
-inline void QQuaternion::setScalar(qreal aScalar) { wp = aScalar; }
+inline void QQuaternion::setX(float aX) { xp = aX; }
+inline void QQuaternion::setY(float aY) { yp = aY; }
+inline void QQuaternion::setZ(float aZ) { zp = aZ; }
+inline void QQuaternion::setScalar(float aScalar) { wp = aScalar; }
inline QQuaternion QQuaternion::conjugate() const
{
@@ -185,7 +185,7 @@ inline QQuaternion &QQuaternion::operator-=(const QQuaternion &quaternion)
return *this;
}
-inline QQuaternion &QQuaternion::operator*=(qreal factor)
+inline QQuaternion &QQuaternion::operator*=(float factor)
{
xp *= factor;
yp *= factor;
@@ -196,16 +196,16 @@ inline QQuaternion &QQuaternion::operator*=(qreal factor)
inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2)
{
- qreal ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
- qreal yy = (q1.wp - q1.yp) * (q2.wp + q2.zp);
- qreal zz = (q1.wp + q1.yp) * (q2.wp - q2.zp);
- qreal xx = ww + yy + zz;
- qreal qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp));
+ float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
+ float yy = (q1.wp - q1.yp) * (q2.wp + q2.zp);
+ float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp);
+ float xx = ww + yy + zz;
+ float qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp));
- qreal w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp);
- qreal x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp);
- qreal y = qq - yy + (q1.wp - q1.xp) * (q2.yp + q2.zp);
- qreal z = qq - zz + (q1.zp + q1.yp) * (q2.wp - q2.xp);
+ float w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp);
+ float x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp);
+ float y = qq - yy + (q1.wp - q1.xp) * (q2.yp + q2.zp);
+ float z = qq - zz + (q1.zp + q1.yp) * (q2.wp - q2.xp);
return QQuaternion(w, x, y, z);
}
@@ -216,7 +216,7 @@ inline QQuaternion &QQuaternion::operator*=(const QQuaternion &quaternion)
return *this;
}
-inline QQuaternion &QQuaternion::operator/=(qreal divisor)
+inline QQuaternion &QQuaternion::operator/=(float divisor)
{
xp /= divisor;
yp /= divisor;
@@ -245,12 +245,12 @@ inline const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2)
return QQuaternion(q1.wp - q2.wp, q1.xp - q2.xp, q1.yp - q2.yp, q1.zp - q2.zp);
}
-inline const QQuaternion operator*(qreal factor, const QQuaternion &quaternion)
+inline const QQuaternion operator*(float factor, const QQuaternion &quaternion)
{
return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor);
}
-inline const QQuaternion operator*(const QQuaternion &quaternion, qreal factor)
+inline const QQuaternion operator*(const QQuaternion &quaternion, float factor)
{
return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor);
}
@@ -260,7 +260,7 @@ inline const QQuaternion operator-(const QQuaternion &quaternion)
return QQuaternion(-quaternion.wp, -quaternion.xp, -quaternion.yp, -quaternion.zp);
}
-inline const QQuaternion operator/(const QQuaternion &quaternion, qreal divisor)
+inline const QQuaternion operator/(const QQuaternion &quaternion, float divisor)
{
return QQuaternion(quaternion.wp / divisor, quaternion.xp / divisor, quaternion.yp / divisor, quaternion.zp / divisor);
}
@@ -275,7 +275,7 @@ inline bool qFuzzyCompare(const QQuaternion& q1, const QQuaternion& q2)
#ifndef QT_NO_VECTOR3D
-inline QQuaternion::QQuaternion(qreal aScalar, const QVector3D& aVector)
+inline QQuaternion::QQuaternion(float aScalar, const QVector3D& aVector)
: wp(aScalar), xp(aVector.x()), yp(aVector.y()), zp(aVector.z()) {}
inline void QQuaternion::setVector(const QVector3D& aVector)
@@ -292,7 +292,7 @@ inline QVector3D QQuaternion::vector() const
#endif
-inline void QQuaternion::setVector(qreal aX, qreal aY, qreal aZ)
+inline void QQuaternion::setVector(float aX, float aY, float aZ)
{
xp = aX;
yp = aY;