|
Python API 2.0 Reference
|
Inheritance diagram for OpenMaya.MQuaternion:Public Member Functions | |
| def | __add__ () |
| def | __delitem__ () |
| def | __eq__ () |
| def | __ge__ () |
| def | __getitem__ () |
| def | __gt__ () |
| def | __imul__ () |
| def | __init__ () |
| def | __le__ () |
| def | __len__ () |
| def | __lt__ () |
| def | __mul__ () |
| def | __ne__ () |
| def | __neg__ () |
| def | __radd__ () |
| def | __repr__ () |
| def | __rmul__ () |
| def | __rsub__ () |
| def | __setitem__ () |
| def | __str__ () |
| def | __sub__ () |
| def | asAxisAngle () |
| def | asEulerRotation () |
| def | asMatrix () |
| def | conjugate () |
| def | conjugateIt () |
| def | exp () |
| def | inverse () |
| def | invertIt () |
| def | isEquivalent () |
| def | log () |
| def | negateIt () |
| def | normal () |
| def | normalizeIt () |
| def | setToXAxis () |
| def | setToYAxis () |
| def | setToZAxis () |
| def | setValue () |
Static Public Member Functions | |
| def | __new__ () |
| def | slerp () |
| def | squad () |
| def | squadPt () |
Static Public Attributes | |
| tuple | kIdentity = maya.api.OpenMaya.MQuaternion(0, 0, 0, 1) |
| int | kTolerance = 1 |
Properties | |
| w = property(...) | |
| x = property(...) | |
| y = property(...) | |
| z = property(...) | |
Quaternion math.
| 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. |
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.
| def OpenMaya.MQuaternion.__init__ | ( | ) |
Initialize self. See help(type(self)) for accurate signature.
| def OpenMaya.MQuaternion.__add__ | ( | ) |
Return self+value.
| def OpenMaya.MQuaternion.__delitem__ | ( | ) |
Delete self[key].
| def OpenMaya.MQuaternion.__eq__ | ( | ) |
Return self==value.
| def OpenMaya.MQuaternion.__ge__ | ( | ) |
Return self>=value.
| def OpenMaya.MQuaternion.__getitem__ | ( | ) |
Return self[key].
| def OpenMaya.MQuaternion.__gt__ | ( | ) |
Return self>value.
| def OpenMaya.MQuaternion.__imul__ | ( | ) |
Return self*=value.
| def OpenMaya.MQuaternion.__le__ | ( | ) |
Return self<=value.
| def OpenMaya.MQuaternion.__len__ | ( | ) |
Return len(self).
| def OpenMaya.MQuaternion.__lt__ | ( | ) |
Return self<value.
| def OpenMaya.MQuaternion.__mul__ | ( | ) |
Return self*value.
| def OpenMaya.MQuaternion.__ne__ | ( | ) |
Return self!=value.
| def OpenMaya.MQuaternion.__neg__ | ( | ) |
-self
|
static |
Create and return a new object. See help(type) for accurate signature.
| def OpenMaya.MQuaternion.__radd__ | ( | ) |
Return value+self.
| def OpenMaya.MQuaternion.__repr__ | ( | ) |
Return repr(self).
| def OpenMaya.MQuaternion.__rmul__ | ( | ) |
Return value*self.
| def OpenMaya.MQuaternion.__rsub__ | ( | ) |
Return value-self.
| def OpenMaya.MQuaternion.__setitem__ | ( | ) |
Set self[key] to value.
| def OpenMaya.MQuaternion.__str__ | ( | ) |
Return str(self).
| def OpenMaya.MQuaternion.__sub__ | ( | ) |
Return self-value.
| OpenMaya.MQuaternion.asAxisAngle | ( | ) |
Returns the rotation as a tuple containing an axis vector and an angle in radians about that axis.
| Signature: | asAxisAngle() |
| Parameters: | |
| Returns: | (MVector, float) |
| Description: | Returns a tuple containing an axis and angle in radians which is equivalent to the rotation represented by the quaternion. |
| OpenMaya.MQuaternion.asEulerRotation | ( | ) |
Returns the rotation as an equivalent MEulerRotation.
| Signature: | asEulerRotation() |
| Parameters: | |
| Returns: | MEulerRotation |
| Description: | Returns the quaternion as an equivalent euler rotation. |
| OpenMaya.MQuaternion.asMatrix | ( | ) |
Returns the rotation as an equivalent rotation matrix.
| Signature: | asMatrix() |
| Parameters: | |
| Returns: | MMatrix |
| Description: | Returns the quaternion as an equivalent rotation matrix. |
| OpenMaya.MQuaternion.conjugate | ( | ) |
Returns the conjugate of this quaternion (i.e. x, y and z components negated).
| Signature: | conjugate() |
| Parameters: | |
| Returns: | MQuaternion |
| Description: | Returns a new quaternion containing the conjugate of this one (i.e. x, y and z components negated). |
| OpenMaya.MQuaternion.conjugateIt | ( | ) |
In-place conjugation (i.e. negates the x, y and z components).
| Signature: | conjugateIt() |
| Parameters: | |
| Returns: | Reference to self. |
| Description: | In-place conjugation (i.e. negates the x, y and z components). |
| OpenMaya.MQuaternion.exp | ( | ) |
Returns a new quaternion containing the exponent of this one.
| Signature: | exp() |
| Parameters: | |
| Returns: | MQuaternion |
| Description: | Returns a new quaternion containing the exponent of this one. |
| OpenMaya.MQuaternion.inverse | ( | ) |
Returns a new quaternion containing the inverse of this one.
| Signature: | inverse() |
| Parameters: | |
| Returns: | MQuaternion |
| Description: | Returns a new quaternion containing the inverse of this one. |
| OpenMaya.MQuaternion.invertIt | ( | ) |
In-place inversion.
| Signature: | invertIt() |
| Parameters: | |
| Returns: | Reference to self. |
| Description: | In-place inversion. |
| OpenMaya.MQuaternion.isEquivalent | ( | ) |
Returns True if the distance between the two quaternions (in quaternion space) is less than or equal to the given tolerance.
| Signature: | isEquivalent(other, tolerance=kTolerance) |
| Parameters: | other - MQuaternion tolerance - float |
| Returns: | bool |
| Description: | Returns True if the distance between the two quaternions (in quaternion space) is less than or equal to tolerance. |
| OpenMaya.MQuaternion.log | ( | ) |
Returns a new quaternion containing the natural log of this one.
| Signature: | log() |
| Parameters: | |
| Returns: | MQuaternion |
| Description: | Returns a new quaternion containing the natural log of this one. |
| OpenMaya.MQuaternion.negateIt | ( | ) |
In-place negation of the x, y, z and w components.
| Signature: | negateIt() |
| Parameters: | |
| Returns: | Reference to self. |
| Description: | In-place negation of the x, y, z and w components. |
| OpenMaya.MQuaternion.normal | ( | ) |
Returns a new quaternion containing the normalized version of this one (i.e. scaled to unit length).
| Signature: | normal() |
| Parameters: | |
| Returns: | MQuaternion |
| Description: | Returns a new quaternion containing the normalized version of this one (i.e. scaled to unit length). |
| OpenMaya.MQuaternion.normalizeIt | ( | ) |
In-place normalization (i.e. scales the quaternion to unit length).
| Signature: | normalizeIt() |
| Parameters: | |
| Returns: | Reference to self. |
| Description: | In-place normalization (i.e. scales the quaternion to unit length). |
| OpenMaya.MQuaternion.setToXAxis | ( | ) |
Set this quaternion to be equivalent to a rotation of a given angle, in radians, about the X-axis.
| Signature: | setToXAxis(angle) |
| Parameters: | angle - float |
| Returns: | Reference to self. |
| Description: | Set the value of this quaternion to be equivalent to a rotation of angle radians about the X-axis. |
| OpenMaya.MQuaternion.setToYAxis | ( | ) |
Set this quaternion to be equivalent to a rotation of a given angle, in radians, about the Y-axis.
| Signature: | setToYAxis(angle) |
| Parameters: | angle - float |
| Returns: | Reference to self. |
| Description: | Set the value of this quaternion to be equivalent to a rotation of angle radians about the Y-axis. |
| OpenMaya.MQuaternion.setToZAxis | ( | ) |
Set this quaternion to be equivalent to a rotation of a given angle, in radians, about the Z-axis.
| Signature: | setToZAxis(angle) |
| Parameters: | angle - float |
| Returns: | Reference to self. |
| Description: | Set the value of this quaternion to be equivalent to a rotation of angle radians about the Z-axis. |
| OpenMaya.MQuaternion.setValue | ( | ) |
Set the value of this quaternion to that of the specified MQuaternion, MEulerRotation, MMatrix or MVector and angle.
| Signature: | setValue(quat) |
| Parameters: | quat - MQuaternion |
| Returns: | Reference to self. |
| Description: | Set the value of this quaternion to be the same as quat. |
| Signature: | setValue(rot) |
| Parameters: | rot - MEulerRotation |
| Returns: | Reference to self. |
| Description: | Set the value of this quaternion to be equivalent to the rotation rot. |
| Signature: | setValue(mat) |
| Parameters: | mat - MMatrix |
| Returns: | Reference to self. |
| Description: | Set the value of this quaternion to be equivalent to the rotation derived from decomposing mat. |
| Signature: | setValue(axis, angle) |
| Parameters: | axis - MVector angle - float |
| Returns: | Reference to self. |
| Description: | Set the value of this quaternion to be equivalent to a rotation of angle radians about axis. |
|
static |
Returns the quaternion at a given interpolation value along the shortest path between two quaternions.
| Name: | slerp(p, q, t, spin=0) |
| Parameters: | p - MQuaternion q - MQuaternion t - float spin - int |
| Returns: | MQuaternion |
| Description: | 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. |
|
static |
Returns the quaternion at a given interpolation value along a cubic curve segment in quaternion space.
| Name: | squad(p, a, b, q, t, spin=0) |
| Parameters: | p - MQuaternion a - MQuaternion b - MQuaternion q - MQuaternion t - float spin - int |
| Returns: | MQuaternion |
| Description: | 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. |
|
static |
Returns a new quaternion representing an intermediate point which when used with squad() will produce a C1 continuous spline.
| Name: | squadPt(q0, q1, q2) |
| Parameters: | q0 - MQuaternion q1 - MQuaternion q2 - MQuaternion |
| Returns: | MQuaternion |
| Description: | Returns a new quaternion representing an intermediate point (in quaternion space) which when used with squad() will produce a C1 continuous spline. |
|
static |
| Name: | kIdentity |
| Type: | MQuaternion |
| Description: | Multiplicative identity. |
|
static |
| Name: | kTolerance |
| Type: | float |
| Description: | Default tolerance for non-exact equality tests. |
|
static |
Real component
| Name: | w |
| Type: | float |
| Access: | RW |
| Description: | Real component. |
|
static |
Imaginary X component
| Name: | x |
| Type: | float |
| Access: | RW |
| Description: | Imaginary X component. |
|
static |
Imaginary Y component
| Name: | y |
| Type: | float |
| Access: | RW |
| Description: | Imaginary Y component. |
|
static |
Imaginary Z component
| Name: | z |
| Type: | float |
| Access: | RW |
| Description: | Imaginary Z component. |