The QQuaternion class represents a quaternion consisting of a vector and scalar. 更多...
This class can be pickled.
The 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 with the vector ( xpos , ypos , zpos ) and scalar .
Constructs a quaternion vector from the specified vector and scalar .
Constructs a quaternion from the components of vector .
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 specified 3D axis .
Creates a normalized quaternion that corresponds to rotating through angle degrees about the 3D axis ( x , y , z ).
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.
Returns true if the x, y, z, and scalar components of this quaternion are set to 0.0; otherwise returns false.
Returns the length of the quaternion. This is also called the "norm".
另请参阅 lengthSquared () 和 normalized ().
Returns the squared length of the quaternion.
另请参阅 length ().
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 normalized ().
若 t is less than or equal to 0, then q1 将是 returned. If t is greater than or equal to 1, then q2 将被返回。
The nlerp() function is typically faster than slerp () and will give approximate results to spherical interpolation that are good enough for some applications.
另请参阅 slerp ().
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.
另请参阅 length () and normalized ().
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.
另请参阅 length () and normalize ().
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();
Returns the scalar component of this quaternion.
另请参阅 setScalar (), x (), y (), and z ().
Sets the scalar component of this quaternion to scalar .
另请参阅 scalar (), setX (), setY (),和 setZ ().
Sets the vector component of this quaternion to vector .
另请参阅 vector () and setScalar ().
Sets the vector component of this quaternion to ( x , y , z ).
另请参阅 vector () and setScalar ().
Sets the x coordinate of this quaternion's vector to the given x 坐标。
另请参阅 x (), setY (), setZ (),和 setScalar ().
Sets the y coordinate of this quaternion's vector to the given y 坐标。
另请参阅 y (), setX (), setZ (),和 setScalar ().
Sets the z coordinate of this quaternion's vector to the given z 坐标。
另请参阅 z (), setX (), setY (),和 setScalar ().
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 将是 returned. If t is greater than or equal to 1, then q2 将被返回。
另请参阅 nlerp ().
Returns this quaternion as a 4D vector.
Returns the vector component of this quaternion.
另请参阅 setVector () 和 scalar ().
Returns the x coordinate of this quaternion's vector.
另请参阅 setX (), y (), z (),和 scalar ().
Returns the y coordinate of this quaternion's vector.
另请参阅 setY (), x (), z (),和 scalar ().
Returns the z coordinate of this quaternion's vector.
另请参阅 setZ (), x (), y (),和 scalar ().