
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQVector4D class represents a vector or vertex in 4D space.More...
| Header: | #include <QVector4D> |
| Since: | Qt 4.6 |
| QVector4D() | |
| QVector4D(qreal xpos, qreal ypos, qreal zpos, qreal wpos) | |
| QVector4D(const QPoint & point) | |
| QVector4D(const QPointF & point) | |
| QVector4D(const QVector2D & vector) | |
| QVector4D(const QVector2D & vector, qreal zpos, qreal wpos) | |
| QVector4D(const QVector3D & vector) | |
| QVector4D(const QVector3D & vector, qreal wpos) | |
| bool | isNull() const |
| qreal | length() const |
| qreal | lengthSquared() const |
| void | normalize() |
| QVector4D | normalized() const |
| void | setW(qreal w) |
| void | setX(qreal x) |
| void | setY(qreal y) |
| void | setZ(qreal z) |
| QPoint | toPoint() const |
| QPointF | toPointF() const |
| QVector2D | toVector2D() const |
| QVector2D | toVector2DAffine() const |
| QVector3D | toVector3D() const |
| QVector3D | toVector3DAffine() const |
| qreal | w() const |
| qreal | x() const |
| qreal | y() const |
| qreal | z() const |
| operator QVariant() const | |
| QVector4D & | operator*=(qreal factor) |
| QVector4D & | operator*=(const QVector4D & vector) |
| QVector4D & | operator+=(const QVector4D & vector) |
| QVector4D & | operator-=(const QVector4D & vector) |
| QVector4D & | operator/=(qreal divisor) |
| qreal | dotProduct(const QVector4D & v1, const QVector4D & v2) |
| bool | qFuzzyCompare(const QVector4D & v1, const QVector4D & v2) |
| bool | operator!=(const QVector4D & v1, const QVector4D & v2) |
| const QVector4D | operator*(qreal factor, const QVector4D & vector) |
| const QVector4D | operator*(const QVector4D & vector, qreal factor) |
| const QVector4D | operator*(const QVector4D & v1, const QVector4D & v2) |
| const QVector4D | operator+(const QVector4D & v1, const QVector4D & v2) |
| const QVector4D | operator-(const QVector4D & v1, const QVector4D & v2) |
| const QVector4D | operator-(const QVector4D & vector) |
| const QVector4D | operator/(const QVector4D & vector, qreal divisor) |
| QDataStream & | operator<<(QDataStream & stream, const QVector4D & vector) |
| bool | operator==(const QVector4D & v1, const QVector4D & v2) |
| QDataStream & | operator>>(QDataStream & stream, QVector4D & vector) |
TheQVector4D class represents a vector or vertex in 4D space.
TheQVector4D class can also be used to represent vertices in 4D space. We therefore do not need to provide a separate vertex class.
Note: By design values in theQVector4D instance are stored asfloat. This means that on platforms where theqreal arguments toQVector4D functions are represented bydouble values, it is possible to lose precision.
See alsoQQuaternion,QVector2D, andQVector3D.
Constructs a null vector, i.e. with coordinates (0, 0, 0, 0).
Constructs a vector with coordinates (xpos,ypos,zpos,wpos).
Constructs a vector with x and y coordinates from a 2Dpoint, and z and w coordinates of 0.
Constructs a vector with x and y coordinates from a 2Dpoint, and z and w coordinates of 0.
Constructs a 4D vector from the specified 2Dvector. The z and w coordinates are set to zero.
See alsotoVector2D().
Constructs a 4D vector from the specified 2Dvector. The z and w coordinates are set tozpos andwpos respectively.
See alsotoVector2D().
Constructs a 4D vector from the specified 3Dvector. The w coordinate is set to zero.
See alsotoVector3D().
Constructs a 4D vector from the specified 3Dvector. The w coordinate is set towpos.
See alsotoVector3D().
[static]qreal QVector4D::dotProduct(constQVector4D & v1, constQVector4D & v2)Returns the dot product ofv1 andv2.
Returns true if the x, y, z, and w coordinates are set to 0.0, otherwise returns false.
Returns the length of the vector from the origin.
See alsolengthSquared() andnormalized().
Returns the squared length of the vector from the origin. This is equivalent to the dot product of the vector with itself.
See alsolength() anddotProduct().
Normalizes the currect vector in place. Nothing happens if this vector is a null vector or the length of the vector is very close to 1.
See alsolength() andnormalized().
Returns the normalized unit vector form of this vector.
If this vector is null, then a null vector is returned. If the length of the vector is very close to 1, then the vector will be returned as-is. Otherwise the normalized form of the vector of length 1 will be returned.
See alsolength() andnormalize().
Sets the w coordinate of this point to the givenw coordinate.
See alsow(),setX(),setY(), andsetZ().
Sets the x coordinate of this point to the givenx coordinate.
See alsox(),setY(),setZ(), andsetW().
Sets the y coordinate of this point to the giveny coordinate.
See alsoy(),setX(),setZ(), andsetW().
Sets the z coordinate of this point to the givenz coordinate.
See alsoz(),setX(),setY(), andsetW().
Returns theQPoint form of this 4D vector. The z and w coordinates are dropped.
See alsotoPointF() andtoVector2D().
Returns theQPointF form of this 4D vector. The z and w coordinates are dropped.
See alsotoPoint() andtoVector2D().
Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.
See alsotoVector2DAffine(),toVector3D(), andtoPoint().
Returns the 2D vector form of this 4D vector, dividing the x and y coordinates by the w coordinate and dropping the z coordinate. Returns a null vector if w is zero.
See alsotoVector2D(),toVector3DAffine(), andtoPoint().
Returns the 3D vector form of this 4D vector, dropping the w coordinate.
See alsotoVector3DAffine(),toVector2D(), andtoPoint().
Returns the 3D vector form of this 4D vector, dividing the x, y, and z coordinates by the w coordinate. Returns a null vector if w is zero.
See alsotoVector3D(),toVector2DAffine(), andtoPoint().
Returns the w coordinate of this point.
See alsosetW(),x(),y(), andz().
Returns the x coordinate of this point.
See alsosetX(),y(),z(), andw().
Returns the y coordinate of this point.
See alsosetY(),x(),z(), andw().
Returns the z coordinate of this point.
See alsosetZ(),x(),y(), andw().
Returns the 4D vector as aQVariant.
Multiplies this vector's coordinates by the givenfactor, and returns a reference to this vector.
See alsooperator/=().
Multiplies the components of this vector by the corresponding components invector.
Adds the givenvector to this vector and returns a reference to this vector.
See alsooperator-=().
Subtracts the givenvector from this vector and returns a reference to this vector.
See alsooperator+=().
Divides this vector's coordinates by the givendivisor, and returns a reference to this vector.
See alsooperator*=().
Returns true ifv1 andv2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.
Returns true ifv1 is not equal tov2; otherwise returns false. This operator uses an exact floating-point comparison.
Returns a copy of the givenvector, multiplied by the givenfactor.
See alsoQVector4D::operator*=().
Returns a copy of the givenvector, multiplied by the givenfactor.
See alsoQVector4D::operator*=().
Returns the vector consisting of the multiplication of the components fromv1 andv2.
See alsoQVector4D::operator*=().
Returns aQVector4D object that is the sum of the given vectors,v1 andv2; each component is added separately.
See alsoQVector4D::operator+=().
Returns aQVector4D object that is formed by subtractingv2 fromv1; each component is subtracted separately.
See alsoQVector4D::operator-=().
This is an overloaded function.
Returns aQVector4D object that is formed by changing the sign of all three components of the givenvector.
Equivalent toQVector4D(0,0,0,0) - vector.
Returns theQVector4D object formed by dividing all four components of the givenvector by the givendivisor.
See alsoQVector4D::operator/=().
Writes the givenvector to the givenstream and returns a reference to the stream.
See alsoSerializing Qt Data Types.
Returns true ifv1 is equal tov2; otherwise returns false. This operator uses an exact floating-point comparison.
Reads a 4D vector from the givenstream into the givenvector and returns a reference to the stream.
See alsoSerializing Qt Data Types.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.