4.6 版新增。
def
__add__
(, v2)
def
__div__
(, divisor)
def
__div__
(, divisor)
def
__eq__
(, v2)
def
__iadd__
(vector)
def
__idiv__
(divisor)
def
__idiv__
(vector)
def
__imul__
(factor)
def
__imul__
(vector)
def
__isub__
(vector)
def
__mul__
(, factor)
def
__mul__
(, matrix)
def
__mul__
(, v2)
def
__mul__
(factor)
def
__mul__
(matrix)
def
__ne__
(, v2)
def
__reduce__
()
def
__repr__
()
def
__sub__
()
def
__sub__
(, v2)
def
isNull
()
def
length
()
def
lengthSquared
()
def
normalize
()
def
normalized
()
def
operator[]
(i)
def
setW
(w)
def
setX
(x)
def
setY
(y)
def
setZ
(z)
def
toPoint
()
def
toPointF
()
def
toTuple
()
def
toVector2D
()
def
toVector2DAffine
()
def
toVector3D
()
def
toVector3DAffine
()
def
w
()
def
x
()
def
y
()
def
z
()
def
dotProduct
(v1, v2)
QVector4Dclass can also be used to represent vertices in 4D space. We therefore do not need to provide a separate vertex class.
QVector4D
¶
QVector4D(point)
QVector4D(point)
QVector4D(vector)
QVector4D(vector, zpos, wpos)
QVector4D(vector)
QVector4D(vector, wpos)
QVector4D(xpos, ypos, zpos, wpos)
- param ypos
float- param point
QPoint- param wpos
float- param zpos
float- param vector
- param xpos
float
Constructs a null vector, i.e. with coordinates (0, 0, 0, 0).
构造 4D 向量从指定 2D
vector
. The z and w coordinates are set to
zpos
and
wpos
分别。
另请参阅
构造 4D 向量从指定 3D
vector
. The w coordinate is set to
wpos
.
另请参阅
构造向量采用坐标 (
xpos
,
ypos
,
zpos
,
wpos
).
PySide2.QtGui.QVector4D.
__reduce__
(
)
¶
PyObject
PySide2.QtGui.QVector4D.
__repr__
(
)
¶
PyObject
PySide2.QtGui.QVector4D.
dotProduct
(
v1
,
v2
)
¶
Returns the dot product of
v1
and
v2
.
PySide2.QtGui.QVector4D.
isNull
(
)
¶
bool
返回
true
if the x, y, z, and w coordinates are set to 0.0, otherwise returns
false
.
PySide2.QtGui.QVector4D.
length
(
)
¶
float
从原点返回向量长度。
PySide2.QtGui.QVector4D.
lengthSquared
(
)
¶
float
Returns the squared length of the vector from the origin. This is equivalent to the dot product of the vector with itself.
另请参阅
PySide2.QtGui.QVector4D.
normalize
(
)
¶
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.
另请参阅
PySide2.QtGui.QVector4D.
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.
另请参阅
PySide2.QtGui.QVector4D.
__mul__
(
matrix
)
¶
matrix
–
QMatrix4x4
PySide2.QtGui.QVector4D.
__mul__
(
matrix
)
¶
matrix
–
QMatrix4x4
PySide2.QtGui.QVector4D.
__imul__
(
factor
)
¶
factor
–
float
Multiplies this vector’s coordinates by the given
factor
, and returns a reference to this vector.
另请参阅
operator/=()
PySide2.QtGui.QVector4D.
__iadd__
(
vector
)
¶
添加给定
vector
to this vector and returns a reference to this vector.
另请参阅
operator-=()
PySide2.QtGui.QVector4D.
__isub__
(
vector
)
¶
Subtracts the given
vector
from this vector and returns a reference to this vector.
另请参阅
operator+=()
PySide2.QtGui.QVector4D.
__idiv__
(
divisor
)
¶
divisor
–
float
Divides this vector’s coordinates by the given
divisor
, and returns a reference to this vector.
另请参阅
operator*=()
PySide2.QtGui.QVector4D.operator[](i)
i
–
int
float
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).
PySide2.QtGui.QVector4D.
setW
(
w
)
¶
w
–
float
Sets the w coordinate of this point to the given
w
坐标。
PySide2.QtGui.QVector4D.
setX
(
x
)
¶
x
–
float
Sets the x coordinate of this point to the given
x
坐标。
PySide2.QtGui.QVector4D.
setY
(
y
)
¶
y
–
float
Sets the y coordinate of this point to the given
y
坐标。
PySide2.QtGui.QVector4D.
setZ
(
z
)
¶
z
–
float
Sets the z coordinate of this point to the given
z
坐标。
PySide2.QtGui.QVector4D.
toPoint
(
)
¶
QPoint
返回
QPoint
form of this 4D vector. The z and w coordinates are dropped.
另请参阅
PySide2.QtGui.QVector4D.
toPointF
(
)
¶
QPointF
返回
QPointF
form of this 4D vector. The z and w coordinates are dropped.
另请参阅
PySide2.QtGui.QVector4D.
toTuple
(
)
¶
PyObject
PySide2.QtGui.QVector4D.
toVector2D
(
)
¶
Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.
PySide2.QtGui.QVector4D.
toVector2DAffine
(
)
¶
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.
PySide2.QtGui.QVector4D.
toVector3D
(
)
¶
Returns the 3D vector form of this 4D vector, dropping the w coordinate.
PySide2.QtGui.QVector4D.
toVector3DAffine
(
)
¶
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.
PySide2.QtGui.QVector4D.
w
(
)
¶
float
返回此点的 w 坐标。
PySide2.QtGui.QVector4D.
x
(
)
¶
float
返回此点的 x 坐标。
PySide2.QtGui.QVector4D.
y
(
)
¶
float
返回此点的 y 坐标。
PySide2.QtGui.QVector4D.
z
(
)
¶
float
返回此点的 z 坐标。