Name | Type | Description |
---|---|---|
identity | MQuaternion | Multiplicative identity. |
kTolerance | float | Default tolerance for non-exact equality tests. |
Name | Parameters | Returns | Description |
---|---|---|---|
slerp(p, q, t, spin=0) | p - MQuaternion
q - MQuaternion t - float spin - int |
MQuaternion | Spherical interpolation of unit quaternions. Returns a quaternion along the shortest path (in quaternion space) between p and q, at interpolation value t. Thus a value of 0.0 will return p while a value of 1.0 will return q. spins gives the number of complete rotations about the axis which must occur when going from p to q. |
squad(p, a, b, q, t, spin=0) | p - MQuaternion
a - MQuaternion b - MQuaternion q - MQuaternion t - float spin - int |
MQuaternion | Interpolation along a cubic curve segment in quaternion space. Returns a quaternion along the cubic curve segment which interpolates p and q, at interpolation value t. Thus a value of 0.0 will return p while a value of 1.0 will return q. The curve is C1 continuous with a and b as intermediate points. spins gives the number of complete rotations about the axis which must occur when going from p to q. |
squadPt(q0, q1, q2) | q0 - MQuaternion
q1 - MQuaternion q2 - MQuaternion |
MQuaternion | Returns a new quaternion representing an intermediate point (in quaternion space) which when used with squad() will produce a C1 continuous spline. |
Signature | Parameters | Description |
---|---|---|
MQuaternion() | Default constructor. Returns a new MQuaternion object, initialized to the multiplicative identity. | |
MQuaternion(src) | src - MQuaternion | Copy constructor. Returns a new MQuaternion object with the same value as src. |
MQuaternion(x, y, z, w) | x - float
y - float z - float w - float |
Returns a new MQuaternion object with its imaginary components set to x, y and z and its real component set to w. |
MQuaternion(seq) | seq - sequence of 4 floats | Returns a new MQuaternion object with its x, y, z, and w components set to the elements of seq. |
MQuaternion(a, b, factor=1.0) | a - MVector
b - MVector factor - float |
Returns a new MQuaternion which will rotate vector a into vector b, about their mutually perpendicular axis. If factor is less than 1 then it will rotate only part of the way into b. If factor is greater than 1 then it will overshoot b. |
MQuaternion(angle, axis) | angle - float
axis - MVector |
Returns a new MQuaternion representing a rotation of angle radians about axis. |
Signature | Parameters | Returns | Description |
---|---|---|---|
asAxisAngle() | (MVector, float) | Returns a tuple containing an axis and angle in radians which is equivalent to the rotation represented by the quaternion. | |
asEulerRotation() | MEulerRotation | Returns the quaternion as an equivalent euler rotation. | |
asMatrix() | MMatrix | Returns the quaternion as an equivalent rotation matrix. | |
conjugate() | MQuaternion | Returns a new quaternion containing the conjugate of this one (i.e. x, y and z components negated). | |
conjugateIt() | Reference to self. | In-place conjugation (i.e. negates the x, y and z components). | |
exp() | MQuaternion | Returns a new quaternion containing the exponent of this one. | |
inverse() | MQuaternion | Returns a new quaternion containing the inverse of this one. | |
invertIt() | Reference to self. | In-place inversion. | |
isEquivalent(other, tolerance=kTolerance) | other - MQuaternion
tolerance - float |
bool | Returns True if the distance between the two quaternions (in quaternion space) is less than or equal to tolerance. |
log() | MQuaternion | Returns a new quaternion containing the natural log of this one. | |
negateIt() | Reference to self. | In-place negation of the x, y, z and w components. | |
normal() | MQuaternion | Returns a new quaternion containing the normalized version of this one (i.e. scaled to unit length). | |
normalizeIt() | Reference to self. | In-place normalization (i.e. scales the quaternion to unit length). | |
setToXAxis(angle) | angle - float | Reference to self. | Set the value of this quaternion to be equivalent to a rotation of angle radians about the X-axis. |
setToYAxis(angle) | angle - float | Reference to self. | Set the value of this quaternion to be equivalent to a rotation of angle radians about the Y-axis. |
setToZAxis(angle) | angle - float | Reference to self. | Set the value of this quaternion to be equivalent to a rotation of angle radians about the Z-axis. |
setValue(quat) | quat - MQuaternion | Reference to self. | Set the value of this quaternion to be the same as quat. |
setValue(rot) | rot - MEulerRotation | Reference to self. | Set the value of this quaternion to be equivalent to the rotation rot. |
setValue(mat) | mat - MMatrix | Reference to self. | Set the value of this quaternion to be equivalent to the rotation derived from decomposing mat. |
setValue(axis, angle) | axis - MVector
angle - float |
Reference to self. | Set the value of this quaternion to be equivalent to a rotation of angle radians about axis. |
Name | Type | Access | Description |
---|---|---|---|
x | float | RW | Imaginary X component. |
y | float | RW | Imaginary Y component. |
z | float | RW | Imaginary Z component. |
w | float | RW | Real component. |
An MQuaternion is treated as a sequence of four float values: [x, y, z, w].
len() returns 4.
Indexing and element assignment are supported.
Deletion, concatenation, repetition and slicing are not supported.
Operation | Result |
---|---|
MQuaternion = MQuaternion + MQuaternion | Component-by-component addition. |
MQuaternion = MQuaternion - MQuaternion | Component-by-component subtraction. |
MQuaternion = -MQuaternion | Component-by-component negation. |
MQuaternion = MQuaternion * MQuaternion | Multiplication by another quaternion. |
MQuaternion *= MQuaternion | In-place multiplication by another quaternion. Returns a reference to the left operand. |
MQuaternion = float * MQuaternion | Scaling of each component by the float. |
== | Exact equality comparison. Returns True if each component of the left operand is exactly equal to the corresponding component of the right operand. |
!= | Exact inequality comparison. Returns True if any component of the left operand is not exactly equal to the corresponding component of the right operand. |
All other comparison operators will raise a TypeError exception.
© 2011 Autodesk, Inc. All rights reserved.