- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

Classes | Functions

# qquaternion.h File Reference

`#include <QtGui/qvector3d.h>`
`#include <QtGui/qvector4d.h>`

Go to the source code of this file.

## Classes
class | QQuaternion
## Functions
| Q_DECLARE_TYPEINFO (QQuaternion, Q_MOVABLE_TYPE)
const QQuaternion | operator* (const QQuaternion &q1, const QQuaternion &q2)
bool | operator== (const QQuaternion &q1, const QQuaternion &q2)
bool | operator!= (const QQuaternion &q1, const QQuaternion &q2)
const QQuaternion | operator+ (const QQuaternion &q1, const QQuaternion &q2)
const QQuaternion | operator- (const QQuaternion &q1, const QQuaternion &q2)
const QQuaternion | operator* (qreal factor, const QQuaternion &quaternion)
const QQuaternion | operator* (const QQuaternion &quaternion, qreal factor)
const QQuaternion | operator- (const QQuaternion &quaternion)
const QQuaternion | operator/ (const QQuaternion &quaternion, qreal divisor)
bool | qFuzzyCompare (const QQuaternion &q1, const QQuaternion &q2)
Q_GUI_EXPORT QDebug | operator<< (QDebug dbg, const QQuaternion &q)
Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &, const QQuaternion &)
Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &, QQuaternion &)

## Function Documentation

Q_DECLARE_TYPEINFO | ( | QQuaternion | ,
|  | Q_MOVABLE_TYPE |
| ) |  |

Search for all occurrences

const QQuaternion operator* | ( | const QQuaternion & | q1,
|  | const QQuaternion & | q2
| ) |  | `[inline]`

Definition at line 198 of file qquaternion.h.

    {
        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));

        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);

        return QQuaternion(w, x, y, z);
    }

bool operator== | ( | const QQuaternion & | q1,
|  | const QQuaternion & | q2
| ) |  | `[inline]`

Definition at line 229 of file qquaternion.h.

    {
        return q1.xp == q2.xp && q1.yp == q2.yp && q1.zp == q2.zp && q1.wp == q2.wp;
    }

bool operator!= | ( | const QQuaternion & | q1,
|  | const QQuaternion & | q2
| ) |  | `[inline]`

Definition at line 234 of file qquaternion.h.

    {
        return q1.xp != q2.xp || q1.yp != q2.yp || q1.zp != q2.zp || q1.wp != q2.wp;
    }

const QQuaternion operator+ | ( | const QQuaternion & | q1,
|  | const QQuaternion & | q2
| ) |  | `[inline]`

Definition at line 239 of file qquaternion.h.

    {
        return QQuaternion(q1.wp + q2.wp, q1.xp + q2.xp, q1.yp + q2.yp, q1.zp + q2.zp);
    }

const QQuaternion operator- | ( | const QQuaternion & | q1,
|  | const QQuaternion & | q2
| ) |  | `[inline]`

Definition at line 244 of file qquaternion.h.

    {
        return QQuaternion(q1.wp - q2.wp, q1.xp - q2.xp, q1.yp - q2.yp, q1.zp - q2.zp);
    }

const QQuaternion operator* | ( | qreal | factor,
|  | const QQuaternion & | quaternion
| ) |  | `[inline]`

Definition at line 249 of file qquaternion.h.

    {
        return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor);
    }

const QQuaternion operator* | ( | const QQuaternion & | quaternion,
|  | qreal | factor
| ) |  | `[inline]`

Definition at line 254 of file qquaternion.h.

    {
        return QQuaternion(quaternion.wp * factor, quaternion.xp * factor, quaternion.yp * factor, quaternion.zp * factor);
    }

const QQuaternion operator- | ( | const QQuaternion & | quaternion | ) | `[inline]`

Definition at line 259 of file qquaternion.h.

    {
        return QQuaternion(-quaternion.wp, -quaternion.xp, -quaternion.yp, -quaternion.zp);
    }

const QQuaternion operator/ | ( | const QQuaternion & | quaternion,
|  | qreal | divisor
| ) |  | `[inline]`

Definition at line 264 of file qquaternion.h.

    {
        return QQuaternion(quaternion.wp / divisor, quaternion.xp / divisor, quaternion.yp / divisor, quaternion.zp / divisor);
    }

bool qFuzzyCompare | ( | const QQuaternion & | q1,
|  | const QQuaternion & | q2
| ) |  | `[inline]`

Search for all occurrences

Definition at line 269 of file qquaternion.h.

    {
        return qFuzzyCompare(q1.xp, q2.xp) &&
               qFuzzyCompare(q1.yp, q2.yp) &&
               qFuzzyCompare(q1.zp, q2.zp) &&
               qFuzzyCompare(q1.wp, q2.wp);
    }

Q_GUI_EXPORT QDebug operator<< | ( | QDebug | dbg,
|  | const QQuaternion & | q
| ) |  |

Q_GUI_EXPORT QDataStream& operator<< | ( | QDataStream & | ,
|  | const QQuaternion & |
| ) |  |

Q_GUI_EXPORT QDataStream& operator>> | ( | QDataStream & | ,
|  | QQuaternion & |
| ) |  |