- Qt 6.9
- Qt GUI
- QQuaternion Proxy Page
- Qt 6.9.2 Reference Documentation

# QQuaternion Proxy Page

## Functions

bool | qFuzzyCompare(const QQuaternion &q1, const QQuaternion &q2)
QQuaternion | operator*(const QQuaternion &q1, const QQuaternion &q2)
QVector3D | operator*(const QQuaternion &quaternion, const QVector3D &vec)
QQuaternion | operator*(const QQuaternion &quaternion, float factor)
QQuaternion | operator*(float factor, const QQuaternion &quaternion)
QQuaternion | operator+(const QQuaternion &q1, const QQuaternion &q2)
QQuaternion | operator-(const QQuaternion &quaternion)
QQuaternion | operator-(const QQuaternion &q1, const QQuaternion &q2)
QQuaternion | operator/(const QQuaternion &quaternion, float divisor)
QDataStream & | operator<<(QDataStream &stream, const QQuaternion &quaternion)
QDataStream & | operator>>(QDataStream &stream, QQuaternion &quaternion)

## Function Documentation

### `[constexpr noexcept]` bool qFuzzyCompare(const QQuaternion &q1, const QQuaternion &q2)

Returns `true` if q1 and q2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.

### `[constexpr noexcept]` QQuaternion operator*(const QQuaternion &q1, const QQuaternion &q2)

Multiplies q1 and q2 using quaternion multiplication. The result corresponds to applying both of the rotations specified by q1 and q2.

See also QQuaternion::operator*=().

### QVector3D operator*(const QQuaternion &quaternion, const QVector3D &vec)

Rotates a vector vec with a quaternion quaternion to produce a new vector in 3D space.

### `[constexpr noexcept]` QQuaternion operator*(const QQuaternion &quaternion, float factor)

Returns a copy of the given quaternion, multiplied by the given factor.

See also QQuaternion::operator*=().

### `[constexpr noexcept]` QQuaternion operator*(float factor, const QQuaternion &quaternion)

Returns a copy of the given quaternion, multiplied by the given factor.

See also QQuaternion::operator*=().

### `[constexpr noexcept]` QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2)

Returns a QQuaternion object that is the sum of the given quaternions, q1 and q2; each component is added separately.

See also QQuaternion::operator+=().

### `[constexpr noexcept]` QQuaternion operator-(const QQuaternion &quaternion)

Returns a QQuaternion object that is formed by changing the sign of all three components of the given quaternion.

Equivalent to `QQuaternion(0,0,0,0) - quaternion`.

This is an overloaded function.

### `[constexpr noexcept]` QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2)

Returns a QQuaternion object that is formed by subtracting q2 from q1; each component is subtracted separately.

See also QQuaternion::operator-=().

### `[constexpr]` QQuaternion operator/(const QQuaternion &quaternion, float divisor)

Returns the QQuaternion object formed by dividing all components of the given quaternion by the given divisor.

See also QQuaternion::operator/=().

### QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)

Writes the given quaternion to the given stream and returns a reference to the stream.

See also Serializing Qt Data Types.

### QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion)

Reads a quaternion from the given stream into the given quaternion and returns a reference to the stream.

See also Serializing Qt Data Types.