45 #include <QtCore/qdebug.h> 46 #include <QtCore/qvariant.h> 47 #include <QtCore/qmath.h> 51 #ifndef QT_NO_VECTOR2D 110 #ifndef QT_NO_VECTOR3D 126 #ifndef QT_NO_VECTOR4D 229 double len = double(
xp) * double(
xp) +
230 double(
yp) * double(
yp);
234 return *
this /
qSqrt(len);
248 double len = double(
xp) * double(
xp) +
249 double(
yp) * double(
yp);
313 return v1.
xp * v2.
xp + v1.
yp * v2.
yp;
428 #ifndef QT_NO_VECTOR3D 442 #ifndef QT_NO_VECTOR4D 486 #ifndef QT_NO_DEBUG_STREAM 490 dbg.
nospace() <<
"QVector2D(" << vector.
x() <<
", " << vector.
y() <<
')';
496 #ifndef QT_NO_DATASTREAM 513 stream << double(vector.
x()) <<
double(vector.
y());
540 #endif // QT_NO_DATASTREAM 542 #endif // QT_NO_VECTOR2D 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 normalized() const
Returns the normalized unit vector form of this vector.
void normalize()
Normalizes the currect vector in place.
QDebug & nospace()
Clears the stream's internal flag that records whether the last character was a space and returns a r...
The QVector4D class represents a vector or vertex in 4D space.
static qreal dotProduct(const QVector2D &v1, const QVector2D &v2)
Returns the dot product of v1 and v2.
void setX(qreal x)
Sets the x coordinate of this point to the given x coordinate.
qreal length() const
Returns the length of the vector from the origin.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QVector3D toVector3D() const
Returns the 3D form of this 2D vector, with the z coordinate set to zero.
QDataStream & operator>>(QDataStream &stream, QVector2D &vector)
Reads a 2D vector from the given stream into the given vector and returns a reference to the stream...
The QVector2D class represents a vector or vertex in 2D space.
qreal x() const
Returns the x coordinate of this point.
void setY(qreal y)
Sets the y coordinate of this point to the given y coordinate.
qreal lengthSquared() const
Returns the squared length of the vector from the origin.
QDataStream & operator<<(QDataStream &stream, const QVector2D &vector)
Writes the given vector to the given stream and returns a reference to the stream.
qreal y() const
Returns the y coordinate of this point.
QVector4D toVector4D() const
Returns the 4D form of this 2D vector, with the z and w coordinates set to zero.
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.
QVector2D()
Constructs a null vector, i.