QVector4D 類錶示 4D 空間中的嚮量或頂點。 更多...
| 頭: | #include <QVector4D> |
| qmake: | QT += gui |
| Since: | Qt 4.6 |
該類在 Qt 4.6 引入。
| QVector4D (const QVector3D & vector , float wpos ) | |
| QVector4D (const QVector3D & vector ) | |
| QVector4D (const QVector2D & vector , float zpos , float wpos ) | |
| QVector4D (const QVector2D & vector ) | |
| QVector4D (const QPointF & point ) | |
| QVector4D (const QPoint & point ) | |
| QVector4D (float xpos , float ypos , float zpos , float wpos ) | |
| QVector4D () | |
| bool | isNull () const |
| float | length () const |
| float | lengthSquared () const |
| void | normalize () |
| QVector4D | normalized () const |
| void | setW (float w ) |
| void | setX (float x ) |
| void | setY (float y ) |
| void | setZ (float z ) |
| QPoint | toPoint () const |
| QPointF | toPointF () const |
| QVector2D | toVector2D () const |
| QVector2D | toVector2DAffine () const |
| QVector3D | toVector3D () const |
| QVector3D | toVector3DAffine () const |
| float | w () const |
| float | x () const |
| float | y () const |
| float | z () const |
| QVariant | operator QVariant () const |
| QVector4D & | operator*= (float factor ) |
| QVector4D & | operator*= (const QVector4D & vector ) |
| QVector4D & | operator+= (const QVector4D & vector ) |
| QVector4D & | operator-= (const QVector4D & vector ) |
| QVector4D & | operator/= (float divisor ) |
| QVector4D & | operator/= (const QVector4D & vector ) |
| float & | operator[] (int i ) |
| float | operator[] (int i ) const |
| float | 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* (float factor , const QVector4D & vector ) |
| const QVector4D | operator* (const QVector4D & vector , float 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 , float divisor ) |
| const QVector4D | operator/ (const QVector4D & vector , const QVector4D & divisor ) |
| QDataStream & | operator<< (QDataStream & stream , const QVector4D & vector ) |
| bool | operator== (const QVector4D & v1 , const QVector4D & v2 ) |
| QDataStream & | operator>> (QDataStream & stream , QVector4D & vector ) |
The QVector4D class can also be used to represent vertices in 4D space. We therefore do not need to provide a separate vertex class.
另請參閱 QQuaternion , QVector2D ,和 QVector3D .
構造 4D 嚮量從指定 3D vector 。w 坐標被設為 wpos .
另請參閱 toVector3D ().
構造 4D 嚮量從指定 3D vector . The w coordinate is set to zero.
另請參閱 toVector3D ().
構造 4D 嚮量從指定 2D vector . The z and w coordinates are set to zpos and wpos 分彆。
另請參閱 toVector2D ().
構造 4D 嚮量從指定 2D vector . The z and w coordinates are set to zero.
另請參閱 toVector2D ().
Constructs a vector with x and y coordinates from a 2D point , and z and w coordinates of 0.
Constructs a vector with x and y coordinates from a 2D point , and z and w coordinates of 0.
構造嚮量采用坐標 ( xpos , ypos , zpos , wpos ).
Constructs a null vector, i.e. with coordinates (0, 0, 0, 0).
[static]
float
QVector4D::
dotProduct
(const
QVector4D
&
v1
, const
QVector4D
&
v2
)
返迴點積為 v1 and v2 .
返迴
true
若 x、y、z 和 w 坐標被設為 0.0,否則返迴
false
.
從原點返迴嚮量長度。
另請參閱 lengthSquared () 和 normalized ().
Returns the squared length of the vector from the origin. This is equivalent to the dot product of the vector with itself.
另請參閱 length () 和 dotProduct ().
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.
另請參閱 length () 和 normalized ().
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.
另請參閱 length () 和 normalize ().
Sets the w coordinate of this point to the given w 坐標。
另請參閱 w (), setX (), setY (),和 setZ ().
將此點的 X 坐標設為給定 x 坐標。
另請參閱 x (), setY (), setZ (),和 setW ().
將此點的 Y 坐標設為給定 y 坐標。
另請參閱 y (), setX (), setZ (),和 setW ().
Sets the z coordinate of this point to the given z 坐標。
另請參閱 z (), setX (), setY (),和 setW ().
返迴 QPoint form of this 4D vector. The z and w coordinates are dropped.
另請參閱 toPointF () 和 toVector2D ().
返迴 QPointF form of this 4D vector. The z and w coordinates are dropped.
另請參閱 toPoint () 和 toVector2D ().
Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.
另請參閱 toVector2DAffine (), toVector3D (),和 toPoint ().
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.
另請參閱 toVector2D (), toVector3DAffine (),和 toPoint ().
Returns the 3D vector form of this 4D vector, dropping the w coordinate.
另請參閱 toVector3DAffine (), toVector2D (),和 toPoint ().
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.
另請參閱 toVector3D (), toVector2DAffine (),和 toPoint ().
返迴此點的 w 坐標。
另請參閱 setW (), x (), y (),和 z ().
返迴此點的 X 坐標。
另請參閱 setX (), y (), z (),和 w ().
返迴此點的 Y 坐標。
另請參閱 setY (), x (), z (),和 w ().
返迴此點的 z 坐標。
另請參閱 setZ (), x (), y (),和 w ().
將 4D 嚮量返迴作為 QVariant .
Multiplies this vector's coordinates by the given factor , and returns a reference to this vector.
另請參閱 operator/= ().
Multiplies the components of this vector by the corresponding components in vector .
添加給定 vector to this vector and returns a reference to this vector.
另請參閱 operator-= ().
減去給定 vector from this vector and returns a reference to this vector.
另請參閱 operator+= ().
Divides this vector's coordinates by the given divisor , and returns a reference to this vector.
另請參閱 operator*= ().
Divides the components of this vector by the corresponding components in vector .
該函數在 Qt 5.5 引入。
另請參閱 operator*= ().
Returns the component of the vector at index position i 作為可修改引用。
i must be a valid index position in the vector (i.e., 0 <= i < 4).
該函數在 Qt 5.2 引入。
Returns the component of the vector at index position i .
i must be a valid index position in the vector (i.e., 0 <= i < 4).
該函數在 Qt 5.2 引入。
返迴
true
if
v1
and
v2
are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.
返迴
true
if
v1
不等於
v2
;否則返迴
false
。此運算符使用精確浮點比較。
返迴副本為給定 vector ,乘以給定 factor .
另請參閱 QVector4D::operator*= ().
返迴副本為給定 vector ,乘以給定 factor .
另請參閱 QVector4D::operator*= ().
Returns the vector consisting of the multiplication of the components from v1 and v2 .
另請參閱 QVector4D::operator*= ().
返迴 QVector4D object that is the sum of the given vectors, v1 and v2 ;各分量分彆相加。
另請參閱 QVector4D::operator+= ().
返迴 QVector4D 對象的形成是通過減去 v2 from v1 ;分彆減去各分量。
另請參閱 QVector4D::operator-= ().
這是重載函數。
返迴 QVector4D object that is formed by changing the sign of all three components of the given vector .
相當於
QVector4D(0,0,0,0) - vector
.
返迴 QVector4D object formed by dividing all four components of the given vector 通過給定 divisor .
另請參閱 QVector4D::operator/= ().
返迴 QVector4D object formed by dividing components of the given vector by a respective components of the given divisor .
該函數在 Qt 5.5 引入。
另請參閱 QVector4D::operator/= ().
寫入給定 vector 到給定 stream 並返迴流引用。
另請參閱 序列化 Qt 數據類型 .
返迴
true
if
v1
等於
v2
;否則返迴
false
。此運算符使用精確浮點比較。
讀取 4D 嚮量從給定 stream 進給定 vector 並返迴流引用。
另請參閱 序列化 Qt 數據類型 .