OpenMaya.MQuaternion Class Reference
Quaternion math.
Constructors
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 .
Sequence Support
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.
Number Support
Comparison Support
== 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.
OpenMaya.MQuaternion.__init__
(
)
x.__init__(...) initializes x; see help(type(x)) for signature
OpenMaya.MQuaternion.__add__
(
)
OpenMaya.MQuaternion.__delitem__
(
)
x.__delitem__(y) <==> del x[y]
OpenMaya.MQuaternion.__eq__
(
)
OpenMaya.MQuaternion.__ge__
(
)
OpenMaya.MQuaternion.__getitem__
(
)
x.__getitem__(y) <==> x[y]
OpenMaya.MQuaternion.__gt__
(
)
OpenMaya.MQuaternion.__imul__
(
)
OpenMaya.MQuaternion.__le__
(
)
OpenMaya.MQuaternion.__len__
(
)
OpenMaya.MQuaternion.__lt__
(
)
OpenMaya.MQuaternion.__mul__
(
)
OpenMaya.MQuaternion.__ne__
(
)
OpenMaya.MQuaternion.__neg__
(
)
OpenMaya.MQuaternion.__radd__
(
)
OpenMaya.MQuaternion.__repr__
(
)
x.__repr__() <==> repr(x)
OpenMaya.MQuaternion.__rmul__
(
)
OpenMaya.MQuaternion.__rsub__
(
)
OpenMaya.MQuaternion.__setitem__
(
)
x.__setitem__(i, y) <==> x[i]=y
OpenMaya.MQuaternion.__str__
(
)
OpenMaya.MQuaternion.__sub__
(
)
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.
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 .
OpenMaya.MQuaternion.slerp
(
)
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 .
OpenMaya.MQuaternion.squad
(
)
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 .
OpenMaya.MQuaternion.squadPt
(
)
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.
OpenMaya.MQuaternion.kIdentity = maya.api.OpenMaya.MQuaternion(0, 0, 0, 1)
static
Name: kIdentity
Type: MQuaternion
Description: Multiplicative identity.
OpenMaya.MQuaternion.kTolerance = 1
static
Name: kTolerance
Type: float
Description: Default tolerance for non-exact equality tests.
Real component
Name: w
Type: float
Access: RW
Description: Real component.
Imaginary X component
Name: x
Type: float
Access: RW
Description: Imaginary X component.
Imaginary Y component
Name: y
Type: float
Access: RW
Description: Imaginary Y component.
Imaginary Z component
Name: z
Type: float
Access: RW
Description: Imaginary Z component.