45 #include <QtCore/qdebug.h> 46 #include <QtCore/qvariant.h> 47 #include <QtCore/qmath.h> 51 #ifndef QT_NO_VECTOR4D 111 #ifndef QT_NO_VECTOR2D 143 #ifndef QT_NO_VECTOR3D 306 double len = double(
xp) * double(
xp) +
307 double(
yp) * double(
yp) +
308 double(
zp) * double(
zp) +
309 double(
wp) * double(
wp);
313 return *
this /
qSqrt(len);
327 double len = double(
xp) * double(
xp) +
328 double(
yp) * double(
yp) +
329 double(
zp) * double(
zp) +
330 double(
wp) * double(
wp);
513 #ifndef QT_NO_VECTOR2D 541 #ifndef QT_NO_VECTOR3D 600 #ifndef QT_NO_DEBUG_STREAM 605 << vector.
x() <<
", " << vector.
y() <<
", " 606 << vector.
z() <<
", " << vector.
w() <<
')';
612 #ifndef QT_NO_DATASTREAM 629 stream << double(vector.
x()) <<
double(vector.
y())
630 <<
double(vector.
z()) <<
double(vector.
w());
661 #endif // QT_NO_DATASTREAM 663 #endif // QT_NO_VECTOR4D The QVariant class acts like a union for the most common Qt data types.
The QDebug class provides an output stream for debugging information.
The QVector3D class represents a vector or vertex in 3D space.
#define QT_END_NAMESPACE
This macro expands to.
QVector2D toVector2D() const
Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.
QDebug & nospace()
Clears the stream's internal flag that records whether the last character was a space and returns a r...
qreal w() const
Returns the w coordinate of this point.
The QVector4D class represents a vector or vertex in 4D space.
qreal length() const
Returns the length of the vector from the origin.
static bool qIsNull(double d)
#define QT_BEGIN_NAMESPACE
This macro expands to.
qreal x() const
Returns the x coordinate of this point.
void setZ(qreal z)
Sets the z coordinate of this point to the given z coordinate.
QDataStream & operator<<(QDataStream &stream, const QVector4D &vector)
Writes the given vector to the given stream and returns a reference to the stream.
The QVector2D class represents a vector or vertex in 2D space.
static qreal dotProduct(const QVector4D &v1, const QVector4D &v2)
Returns the dot product of v1 and v2.
void normalize()
Normalizes the currect vector in place.
QVector4D()
Constructs a null vector, i.
QVector3D toVector3D() const
Returns the 3D vector form of this 4D vector, dropping the w coordinate.
void setW(qreal w)
Sets the w coordinate of this point to the given w coordinate.
QVector2D toVector2DAffine() const
Returns the 2D vector form of this 4D vector, dividing the x and y coordinates by the w coordinate an...
void setX(qreal x)
Sets the x coordinate of this point to the given x coordinate.
QVector3D toVector3DAffine() const
Returns the 3D vector form of this 4D vector, dividing the x, y, and z coordinates by the w coordinat...
QVector4D normalized() const
Returns the normalized unit vector form of this vector.
qreal lengthSquared() const
Returns the squared length of the vector from the origin.
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
The QDataStream class provides serialization of binary data to a QIODevice.
void setY(qreal y)
Sets the y coordinate of this point to the given y coordinate.
QDataStream & operator>>(QDataStream &stream, QVector4D &vector)
Reads a 4D vector from the given stream into the given vector and returns a reference to the stream...
qreal z() const
Returns the z coordinate of this point.
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
qreal y() const
Returns the y coordinate of this point.