注意
该类在 Qt4.6 引入
PySide.QtGui.QQuaternion class represents a quaternion consisting of a vector and scalar.
Quaternions are used to represent rotations in 3D space, and consist of a 3D rotation axis specified by the x, y, and z coordinates, and a scalar representing the rotation angle.
| 参数: |
|
|---|
Constructs an identity quaternion, i.e. with coordinates (1, 0, 0, 0).
Constructs a quaternion from the components of vector .
Constructs a quaternion vector from the specified vector and scalar .
Constructs a quaternion with the vector ( xpos , ypos , zpos ) and scalar .
| 返回类型: | PyObject |
|---|
| 返回类型: | PyObject |
|---|
| 返回类型: | PySide.QtGui.QQuaternion |
|---|
Returns the conjugate of this quaternion, which is (-x, -y, -z, scalar).
| 参数: |
|
|---|---|
| 返回类型: |
Creates a normalized quaternion that corresponds to rotating through angle degrees about the 3D axis ( x , y , z ).
| 参数: |
|
|---|---|
| 返回类型: |
Creates a normalized quaternion that corresponds to rotating through angle degrees about the specified 3D axis .
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if the x, y, and z components of this quaternion are set to 0.0, and the scalar component is set to 1.0; otherwise returns false.
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if the x, y, z, and scalar components of this quaternion are set to 0.0; otherwise returns false.
| 返回类型: | PySide.QtCore.qreal |
|---|
Returns the length of the quaternion. This is also called the “norm”.
| 返回类型: | PySide.QtCore.qreal |
|---|
Returns the squared length of the quaternion.
| 参数: |
|
|---|---|
| 返回类型: |
Interpolates along the shortest linear path between the rotational positions q1 and q2 。值 t should be between 0 and 1, indicating the distance to travel between q1 and q2 . The result will be PySide.QtGui.QQuaternion.normalized() .
若 t is less than or equal to 0, then q1 will be returned. If t is greater than or equal to 1, then q2 将被返回。
PySide.QtGui.QQuaternion.nlerp() function is typically faster than PySide.QtGui.QQuaternion.slerp() and will give approximate results to spherical interpolation that are good enough for some applications.
Normalizes the currect quaternion in place. Nothing happens if this is a null quaternion or the length of the quaternion is very close to 1.
| 返回类型: | PySide.QtGui.QQuaternion |
|---|
Returns the normalized unit form of this quaternion.
If this quaternion is null, then a null quaternion is returned. If the length of the quaternion is very close to 1, then the quaternion will be returned as-is. Otherwise the normalized form of the quaternion of length 1 will be returned.
| 参数: | q2 – PySide.QtGui.QQuaternion |
|---|---|
| 返回类型: | PySide.QtCore.bool |
| 参数: | factor – PySide.QtCore.qreal |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
| 参数: | factor – PySide.QtCore.qreal |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
| 参数: | q2 – PySide.QtGui.QQuaternion |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
| 参数: | factor – PySide.QtCore.qreal |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
Multiplies this quaternion's components by the given factor , and returns a reference to this quaternion.
另请参阅
PySide.QtGui.QQuaternion.operator/=()
| 参数: | quaternion – PySide.QtGui.QQuaternion |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
Multiplies this quaternion by quaternion and returns a reference to this quaternion.
| 参数: | q2 – PySide.QtGui.QQuaternion |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
| 参数: | quaternion – PySide.QtGui.QQuaternion |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
添加给定 quaternion to this quaternion and returns a reference to this quaternion.
另请参阅
PySide.QtGui.QQuaternion.operator-=()
| 返回类型: | PySide.QtGui.QQuaternion |
|---|
| 参数: | q2 – PySide.QtGui.QQuaternion |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
| 参数: | quaternion – PySide.QtGui.QQuaternion |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
Subtracts the given quaternion from this quaternion and returns a reference to this quaternion.
另请参阅
PySide.QtGui.QQuaternion.operator+=()
| 参数: | divisor – PySide.QtCore.qreal |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
| 参数: | divisor – PySide.QtCore.qreal |
|---|---|
| 返回类型: | PySide.QtGui.QQuaternion |
Divides this quaternion's components by the given divisor , and returns a reference to this quaternion.
另请参阅
PySide.QtGui.QQuaternion.operator*=()
| 参数: | q2 – PySide.QtGui.QQuaternion |
|---|---|
| 返回类型: | PySide.QtCore.bool |
| 参数: | vector – PySide.QtGui.QVector3D |
|---|---|
| 返回类型: | PySide.QtGui.QVector3D |
Rotates vector with this quaternion to produce a new vector in 3D space. The following code:
QVector3D result = q.rotatedVector(vector);
is equivalent to the following:
QVector3D result = (q * QQuaternion(0, vector) * q.conjugate()).vector();
| 返回类型: | PySide.QtCore.qreal |
|---|
Returns the scalar component of this quaternion.
| 参数: | scalar – PySide.QtCore.qreal |
|---|
Sets the scalar component of this quaternion to scalar .
| 参数: | vector – PySide.QtGui.QVector3D |
|---|
Sets the vector component of this quaternion to vector .
| 参数: |
|
|---|
Sets the vector component of this quaternion to ( x , y , z ).
| 参数: | x – PySide.QtCore.qreal |
|---|
Sets the x coordinate of this quaternion's vector to the given x 坐标。
| 参数: | y – PySide.QtCore.qreal |
|---|
Sets the y coordinate of this quaternion's vector to the given y 坐标。
| 参数: | z – PySide.QtCore.qreal |
|---|
Sets the z coordinate of this quaternion's vector to the given z 坐标。
| 参数: |
|
|---|---|
| 返回类型: |
Interpolates along the shortest spherical path between the rotational positions q1 and q2 。值 t should be between 0 and 1, indicating the spherical distance to travel between q1 and q2 .
若 t is less than or equal to 0, then q1 will be returned. If t is greater than or equal to 1, then q2 将被返回。
| 返回类型: | PySide.QtGui.QVector4D |
|---|
Returns this quaternion as a 4D vector.
| 返回类型: | PySide.QtGui.QVector3D |
|---|
Returns the vector component of this quaternion.
| 返回类型: | PySide.QtCore.qreal |
|---|
Returns the x coordinate of this quaternion's vector.
| 返回类型: | PySide.QtCore.qreal |
|---|
Returns the y coordinate of this quaternion's vector.
| 返回类型: | PySide.QtCore.qreal |
|---|
Returns the z coordinate of this quaternion's vector.