• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QMatrix4x4

    下一话题

    QVector4D

    QQuaternion

    注意

    该类在 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.

    class PySide.QtGui. QQuaternion
    class PySide.QtGui. QQuaternion ( QQuaternion )
    class PySide.QtGui. QQuaternion ( vector )
    class PySide.QtGui. QQuaternion ( scalar , vector )
    class PySide.QtGui. QQuaternion ( scalar , xpos , ypos , zpos )
    参数:

    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 .

    PySide.QtGui.QQuaternion. __reduce__ ( )
    返回类型: PyObject
    PySide.QtGui.QQuaternion. __repr__ ( )
    返回类型: PyObject
    PySide.QtGui.QQuaternion. conjugate ( )
    返回类型: PySide.QtGui.QQuaternion

    Returns the conjugate of this quaternion, which is (-x, -y, -z, scalar).

    static PySide.QtGui.QQuaternion. fromAxisAndAngle ( x , y , z , angle )
    参数:
    • x PySide.QtCore.qreal
    • y PySide.QtCore.qreal
    • z PySide.QtCore.qreal
    • angle PySide.QtCore.qreal
    返回类型:

    PySide.QtGui.QQuaternion

    Creates a normalized quaternion that corresponds to rotating through angle degrees about the 3D axis ( x , y , z ).

    static PySide.QtGui.QQuaternion. fromAxisAndAngle ( axis , angle )
    参数:
    返回类型:

    PySide.QtGui.QQuaternion

    Creates a normalized quaternion that corresponds to rotating through angle degrees about the specified 3D axis .

    PySide.QtGui.QQuaternion. isIdentity ( )
    返回类型: 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.QtGui.QQuaternion. isNull ( )
    返回类型: 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.QtGui.QQuaternion. length ( )
    返回类型: PySide.QtCore.qreal

    Returns the length of the quaternion. This is also called the “norm”.

    PySide.QtGui.QQuaternion. lengthSquared ( )
    返回类型: PySide.QtCore.qreal

    Returns the squared length of the quaternion.

    static PySide.QtGui.QQuaternion. nlerp ( q1 , q2 , t )
    参数:
    返回类型:

    PySide.QtGui.QQuaternion

    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.

    PySide.QtGui.QQuaternion. normalize ( )

    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. normalized ( )
    返回类型: 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.

    PySide.QtGui.QQuaternion. __ne__ ( q2 )
    参数: q2 PySide.QtGui.QQuaternion
    返回类型: PySide.QtCore.bool
    PySide.QtGui.QQuaternion. __mul__ ( factor )
    参数: factor PySide.QtCore.qreal
    返回类型: PySide.QtGui.QQuaternion
    PySide.QtGui.QQuaternion. __mul__ ( factor )
    参数: factor PySide.QtCore.qreal
    返回类型: PySide.QtGui.QQuaternion
    PySide.QtGui.QQuaternion. __mul__ ( q2 )
    参数: q2 PySide.QtGui.QQuaternion
    返回类型: PySide.QtGui.QQuaternion
    PySide.QtGui.QQuaternion. __imul__ ( factor )
    参数: 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/=()

    PySide.QtGui.QQuaternion. __imul__ ( quaternion )
    参数: quaternion PySide.QtGui.QQuaternion
    返回类型: PySide.QtGui.QQuaternion

    Multiplies this quaternion by quaternion and returns a reference to this quaternion.

    PySide.QtGui.QQuaternion. __add__ ( q2 )
    参数: q2 PySide.QtGui.QQuaternion
    返回类型: PySide.QtGui.QQuaternion
    PySide.QtGui.QQuaternion. __iadd__ ( quaternion )
    参数: 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. __sub__ ( )
    返回类型: PySide.QtGui.QQuaternion
    PySide.QtGui.QQuaternion. __sub__ ( q2 )
    参数: q2 PySide.QtGui.QQuaternion
    返回类型: PySide.QtGui.QQuaternion
    PySide.QtGui.QQuaternion. __isub__ ( quaternion )
    参数: 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+=()

    PySide.QtGui.QQuaternion. __div__ ( divisor )
    参数: divisor PySide.QtCore.qreal
    返回类型: PySide.QtGui.QQuaternion
    PySide.QtGui.QQuaternion. __idiv__ ( divisor )
    参数: 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*=()

    PySide.QtGui.QQuaternion. __eq__ ( q2 )
    参数: q2 PySide.QtGui.QQuaternion
    返回类型: PySide.QtCore.bool
    PySide.QtGui.QQuaternion. rotatedVector ( vector )
    参数: 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.QtGui.QQuaternion. scalar ( )
    返回类型: PySide.QtCore.qreal

    Returns the scalar component of this quaternion.

    PySide.QtGui.QQuaternion. setScalar ( scalar )
    参数: scalar PySide.QtCore.qreal

    Sets the scalar component of this quaternion to scalar .

    PySide.QtGui.QQuaternion. setVector ( vector )
    参数: vector PySide.QtGui.QVector3D

    Sets the vector component of this quaternion to vector .

    PySide.QtGui.QQuaternion. setVector ( x , y , z )
    参数:
    • x PySide.QtCore.qreal
    • y PySide.QtCore.qreal
    • z PySide.QtCore.qreal

    Sets the vector component of this quaternion to ( x , y , z ).

    PySide.QtGui.QQuaternion. setX ( x )
    参数: x PySide.QtCore.qreal

    Sets the x coordinate of this quaternion's vector to the given x 坐标。

    PySide.QtGui.QQuaternion. setY ( y )
    参数: y PySide.QtCore.qreal

    Sets the y coordinate of this quaternion's vector to the given y 坐标。

    PySide.QtGui.QQuaternion. setZ ( z )
    参数: z PySide.QtCore.qreal

    Sets the z coordinate of this quaternion's vector to the given z 坐标。

    static PySide.QtGui.QQuaternion. slerp ( q1 , q2 , t )
    参数:
    返回类型:

    PySide.QtGui.QQuaternion

    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.QQuaternion. toVector4D ( )
    返回类型: PySide.QtGui.QVector4D

    Returns this quaternion as a 4D vector.

    PySide.QtGui.QQuaternion. vector ( )
    返回类型: PySide.QtGui.QVector3D

    Returns the vector component of this quaternion.

    PySide.QtGui.QQuaternion. x ( )
    返回类型: PySide.QtCore.qreal

    Returns the x coordinate of this quaternion's vector.

    PySide.QtGui.QQuaternion. y ( )
    返回类型: PySide.QtCore.qreal

    Returns the y coordinate of this quaternion's vector.

    PySide.QtGui.QQuaternion. z ( )
    返回类型: PySide.QtCore.qreal

    Returns the z coordinate of this quaternion's vector.