43 #include <QtCore/qmath.h> 44 #include <QtCore/qvariant.h> 45 #include <QtCore/qdebug.h> 49 #ifndef QT_NO_QUATERNION 84 #ifndef QT_NO_VECTOR3D 133 #ifndef QT_NO_VECTOR4D 300 double len = double(
xp) * double(
xp) +
301 double(
yp) * double(
yp) +
302 double(
zp) * double(
zp) +
303 double(
wp) * double(
wp);
307 return *
this /
qSqrt(len);
321 double len = double(
xp) * double(
xp) +
322 double(
yp) * double(
yp) +
323 double(
zp) * double(
zp) +
324 double(
wp) * double(
wp);
414 #ifndef QT_NO_VECTOR3D 451 return QQuaternion(c, x * s, y * s, z * s).normalized();
604 qreal factor1 = 1.0f - t;
606 if ((1.0f - dot) > 0.0000001) {
609 if (sinOfAngle > 0.0000001) {
610 factor1 =
qreal(
qSin((1.0f - t) * angle)) / sinOfAngle;
611 factor2 =
qreal(
qSin(t * angle)) / sinOfAngle;
616 return q1 * factor1 + q2b * factor2;
653 return (q1 * (1.0f - t) + q2b * t).
normalized();
664 #ifndef QT_NO_DEBUG_STREAM 669 <<
", vector:(" << q.
x() <<
", " 670 << q.
y() <<
", " << q.
z() <<
"))";
676 #ifndef QT_NO_DATASTREAM 693 stream << double(quaternion.
scalar()) <<
double(quaternion.
x())
694 <<
double(quaternion.
y()) <<
double(quaternion.
z());
725 #endif // QT_NO_DATASTREAM The QVariant class acts like a union for the most common Qt data types.
QDataStream & operator>>(QDataStream &stream, QEasingCurve &easing)
Reads an easing curve from the given stream into the given easing curve and returns a reference to th...
The QDebug class provides an output stream for debugging information.
QQuaternion()
Constructs an identity quaternion, i.
The QVector3D class represents a vector or vertex in 3D space.
qreal x() const
Returns the x coordinate of this quaternion's vector.
#define QT_END_NAMESPACE
This macro expands to.
void setZ(qreal z)
Sets the z coordinate of this quaternion's vector to the given z coordinate.
static QQuaternion nlerp(const QQuaternion &q1, const QQuaternion &q2, qreal t)
Interpolates along the shortest linear path between the rotational positions q1 and q2...
static QQuaternion slerp(const QQuaternion &q1, const QQuaternion &q2, qreal t)
Interpolates along the shortest spherical path between the rotational positions q1 and q2...
QDebug & nospace()
Clears the stream's internal flag that records whether the last character was a space and returns a r...
void setX(qreal x)
Sets the x coordinate of this quaternion's vector to the given x coordinate.
QVector3D rotatedVector(const QVector3D &vector) const
Rotates vector with this quaternion to produce a new vector in 3D space.
QQuaternion normalized() const
Returns the normalized unit form of this quaternion.
qreal lengthSquared() const
Returns the squared length of the quaternion.
long ASN1_INTEGER_get ASN1_INTEGER * a
qreal x() const
Returns the x coordinate of this point.
QDataStream & operator<<(QDataStream &stream, const QQuaternion &quaternion)
Writes the given quaternion to the given stream and returns a reference to the stream.
static QQuaternion fromAxisAndAngle(const QVector3D &axis, qreal angle)
Creates a normalized quaternion that corresponds to rotating through angle degrees about the specifie...
QVector3D vector() const
Returns the vector component of this quaternion.
qreal scalar() const
Returns the scalar component of this quaternion.
#define QT_BEGIN_NAMESPACE
This macro expands to.
qreal length() const
Returns the length of the quaternion.
void setScalar(qreal scalar)
Sets the scalar component of this quaternion to scalar.
QVector3D normalized() const
Returns the normalized unit vector form of this vector.
qreal z() const
Returns the z coordinate of this point.
qreal y() const
Returns the y coordinate of this quaternion's vector.
qreal angle(const QPointF &p1, const QPointF &p2)
qreal z() const
Returns the z coordinate of this quaternion's vector.
qreal y() const
Returns the y coordinate of this point.
void normalize()
Normalizes the currect quaternion in place.
The QQuaternion class represents a quaternion consisting of a vector and scalar.
QQuaternion conjugate() const
Returns the conjugate of this quaternion, which is (-x, -y, -z, scalar).
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
The QDataStream class provides serialization of binary data to a QIODevice.
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
void setY(qreal y)
Sets the y coordinate of this quaternion's vector to the given y coordinate.
static qreal dot(const QPointF &a, const QPointF &b)