54 #ifndef QT_NO_QUATERNION
63 QQuaternion(qreal scalar, qreal xpos, qreal ypos, qreal zpos);
64 #ifndef QT_NO_VECTOR3D
67 #ifndef QT_NO_VECTOR4D
72 bool isIdentity()
const;
74 #ifndef QT_NO_VECTOR3D
78 void setVector(qreal
x, qreal
y, qreal
z);
88 void setScalar(qreal scalar);
91 qreal lengthSquared()
const;
118 #ifndef QT_NO_VECTOR4D
124 #ifndef QT_NO_VECTOR3D
128 (qreal x, qreal y, qreal z, qreal angle);
136 qreal wp, xp, yp, zp;
148 return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && qIsNull(wp);
153 return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && wp == 1.0f;
200 qreal ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
201 qreal yy = (q1.wp - q1.yp) * (q2.wp + q2.zp);
202 qreal zz = (q1.wp + q1.yp) * (q2.wp - q2.zp);
203 qreal xx = ww + yy + zz;
204 qreal qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp));
206 qreal
w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp);
207 qreal
x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp);
208 qreal
y = qq - yy + (q1.wp - q1.xp) * (q2.yp + q2.zp);
209 qreal
z = qq - zz + (q1.zp + q1.yp) * (q2.wp - q2.xp);
216 *
this = *
this * quaternion;
231 return q1.xp == q2.xp && q1.yp == q2.yp && q1.zp == q2.zp && q1.wp == q2.wp;
236 return q1.xp != q2.xp || q1.yp != q2.yp || q1.zp != q2.zp || q1.wp != q2.wp;
241 return QQuaternion(q1.wp + q2.wp, q1.xp + q2.xp, q1.yp + q2.yp, q1.zp + q2.zp);
246 return QQuaternion(q1.wp - q2.wp, q1.xp - q2.xp, q1.yp - q2.yp, q1.zp - q2.zp);
251 return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor);
256 return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor);
261 return QQuaternion(-quaternion.wp, -quaternion.xp, -quaternion.yp, -quaternion.zp);
266 return QQuaternion(quaternion.wp / divisor, quaternion.xp / divisor, quaternion.yp / divisor, quaternion.zp / divisor);
277 #ifndef QT_NO_VECTOR3D
280 : wp(aScalar), xp(aVector.
x()), yp(aVector.
y()), zp(aVector.
z()) {}
303 #ifndef QT_NO_VECTOR4D
306 : wp(aVector.
w()), xp(aVector.
x()), yp(aVector.
y()), zp(aVector.
z()) {}
315 #ifndef QT_NO_DEBUG_STREAM
319 #ifndef QT_NO_DATASTREAM
QByteArray & operator+=(QByteArray &a, const QStringBuilder< A, B > &b)
bool operator==(const QQuaternion &q1, const QQuaternion &q2)
bool operator!=(const QQuaternion &q1, const QQuaternion &q2)
void setScalar(qreal scalar)
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QQuaternion &q)
QQuaternion & operator+=(const QQuaternion &quaternion)
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QQuaternion &)
QQuaternion & operator-=(const QQuaternion &quaternion)
#define QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(QQuaternion, Q_MOVABLE_TYPE)
QQuaternion & operator*=(qreal factor)
GLdouble GLdouble GLdouble GLdouble q
GLuint GLsizei GLsizei * length
bool qFuzzyCompare(const QQuaternion &q1, const QQuaternion &q2)
QQuaternion conjugate() const
const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2)
GLint GLenum GLboolean normalized
const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2)
QQuaternion & operator/=(qreal divisor)
GLubyte GLubyte GLubyte GLubyte w
const QQuaternion operator*(const QQuaternion &q1, const QQuaternion &q2)
GLXDrawable int64_t int64_t divisor
QVector4D toVector4D() const
void setVector(const QVector3D &vector)
const QQuaternion operator/(const QQuaternion &quaternion, qreal divisor)