C++ API Reference
MEulerRotation Class Reference

Euler Rotation Math. More...

#include <MEulerRotation.h>

Public Types

enum  RotationOrder {
  kXYZ, kYZX, kZXY, kXZY,
  kYXZ, kZYX
}
 Valid rotaton orders. More...
 

Public Member Functions

 MEulerRotation ()
 The default class constructor. More...
 
 MEulerRotation (const MEulerRotation &src)
 The copy constructor. More...
 
 MEulerRotation (const MVector &v, RotationOrder ord=kXYZ)
 Class constructor. More...
 
 MEulerRotation (double xx, double yy, double zz, RotationOrder ord=kXYZ)
 Class constructor. More...
 
 ~MEulerRotation ()
 Class destructor.
 
MEulerRotationoperator= (const MEulerRotation &src)
 The assignment operator. More...
 
MEulerRotationoperator= (const MQuaternion &q)
 The assignment operator. More...
 
MEulerRotationoperator= (const MMatrix &m)
 Convert the given 4X4 homogeneous rotation matrix to a euler rotation. More...
 
MEulerRotationoperator= (const MVector &v)
 The assignment operator. More...
 
MEulerRotationsetValue (const MVector &v, RotationOrder ord=kXYZ)
 Sets the euler rotation to the values contained in the vector and with the specified rotation order. More...
 
MEulerRotationsetValue (double xx, double yy, double zz, RotationOrder ord=kXYZ)
 Sets the euler rotation to the x, y, and z rotation components with the specified rotation order. More...
 
MQuaternion asQuaternion () const
 Converts an euler rotation to a quaternion. More...
 
MMatrix asMatrix () const
 Converts an euler rotation to a rotation matrix. More...
 
MVector asVector () const
 Converts an euler rotation to a vector. More...
 
double operator[] (unsigned int i) const
 The index operator. More...
 
MEulerRotation operator+ (const MEulerRotation &other) const
 The euler rotation addition operator. More...
 
MEulerRotationoperator+= (const MEulerRotation &other)
 The in place euler rotation addition operator. More...
 
MEulerRotation operator- (const MEulerRotation &other) const
 The euler rotation subtraction operator. More...
 
MEulerRotationoperator-= (const MEulerRotation &other)
 The in place euler rotation subtraction operator. More...
 
MEulerRotation operator- () const
 The unary minus operator. More...
 
MEulerRotation operator* (const MEulerRotation &other) const
 The euler rotation multiplication operator. More...
 
MEulerRotation operator* (const MQuaternion &other) const
 This quaternion multiplication operator. More...
 
MEulerRotation operator* (double other) const
 This scalar multiplication operator. More...
 
MEulerRotationoperator*= (const MEulerRotation &other)
 The in place euler rotation multiplication operator. More...
 
MEulerRotationoperator*= (const MQuaternion &other)
 The in place quaternion multiplication operator. More...
 
MEulerRotationoperator*= (double other)
 The in place scalar multiplication operator. More...
 
bool operator== (const MEulerRotation &other) const
 The euler rotation equality operator. More...
 
bool operator!= (const MEulerRotation &other) const
 The euler rotation inequality operator. More...
 
bool isEquivalent (const MEulerRotation &other, double tolerance=kEulerRotationEpsilon) const
 This method returns true if this euler rotation is equivalent, within some given tolerance, to the other euler rotation. More...
 
bool isZero (double tolerance=kEulerRotationEpsilon) const
 This method returns true if this euler rotation is zero, within some given tolerance. More...
 
MEulerRotationincrementalRotateBy (const MVector &axis, double angle)
 Perform an incremental rotation by the specified axis and angle. More...
 
MEulerRotation inverse () const
 Returns the inverse of this euler rotation. More...
 
MEulerRotationinvertIt ()
 Performs an in place inversion of this euler rotation. More...
 
MEulerRotation reorder (RotationOrder ord) const
 Returns the reordering of this euler rotation, such that the euler rotation will have the specified rotation order. More...
 
MEulerRotationreorderIt (RotationOrder ord)
 Performs an in place reordering of this euler rotation, such that the euler rotation will have the specified rotation order. More...
 
MEulerRotation bound () const
 Returns the result of bounding this rotation to be within +/- PI. More...
 
MEulerRotationboundIt (const MEulerRotation &src)
 Sets this euler rotation to be the input rotation that has been bound to be within +/- PI. More...
 
MEulerRotationboundIt ()
 Bounds this rotation to be within +/- PI. More...
 
MEulerRotation alternateSolution () const
 Returns an alternate solution to this rotation. More...
 
MEulerRotationsetToAlternateSolution (const MEulerRotation &src)
 Sets this euler rotation to an alternate solution of the input rotation. More...
 
MEulerRotationsetToAlternateSolution ()
 Sets this euler rotation to an alternate solution of this rotation. More...
 
MEulerRotation closestSolution (const MEulerRotation &dst) const
 Returns the euler rotation that is the closest solution to the "dst" euler rotation. More...
 
MEulerRotationsetToClosestSolution (const MEulerRotation &src, const MEulerRotation &dst)
 Sets this euler rotation to the euler rotation that is the closest solution of the "src" euler rotation to the "dst" euler rotation. More...
 
MEulerRotationsetToClosestSolution (const MEulerRotation &dst)
 Sets this euler rotation to the euler rotation that is the closest solution to the "dst" euler rotation. More...
 
MEulerRotation closestCut (const MEulerRotation &dst) const
 Returns the closest cut of this rotation to "dst". More...
 
MEulerRotationsetToClosestCut (const MEulerRotation &src, const MEulerRotation &dst)
 Sets this rotation to be the closest cut of "src" to "dst". More...
 
MEulerRotationsetToClosestCut (const MEulerRotation &dst)
 Sets this rotation to be the closest cut to "dst". More...
 
double & operator[] (unsigned int i)
 NO SCRIPT SUPPORT. More...
 

Static Public Member Functions

static MEulerRotation decompose (const MMatrix &matrix, RotationOrder ord)
 Decompose a rotation matrix into the desired euler angles with the specified order. More...
 
static MEulerRotation bound (const MEulerRotation &src)
 NO SCRIPT SUPPORT. More...
 
static MEulerRotation alternateSolution (const MEulerRotation &src)
 NO SCRIPT SUPPORT. More...
 
static MEulerRotation closestSolution (const MEulerRotation &src, const MEulerRotation &dst)
 NO SCRIPT SUPPORT. More...
 
static MEulerRotation closestCut (const MEulerRotation &src, const MEulerRotation &dst)
 NO SCRIPT SUPPORT. More...
 

Public Attributes

double x
 The x component of the euler rotation in radians.
 
double y
 The y component of the euler rotation in radians.
 
double z
 The z component of the euler rotation in radians.
 
RotationOrder order
 The rotation order of the euler rotation.
 

Static Public Attributes

static const MEulerRotation identity
 The euler rotation identity. The rotation order is XYZ.
 

Friends

OPENMAYA_EXPORT MEulerRotation operator* (double scale, const MEulerRotation &other)
 NO SCRIPT SUPPORT. More...
 
OPENMAYA_EXPORT std::ostream & operator<< (std::ostream &os, const MEulerRotation &rotation)
 NO SCRIPT SUPPORT. More...
 

Detailed Description

Member Enumeration Documentation

Valid rotaton orders.

Enumerator
kXYZ 

 

kYZX 

 

kZXY 

 

kXZY 

 

kYXZ 

 

kZYX 

 

Constructor & Destructor Documentation

The default class constructor.

The rotation order is set to XYZ.

MEulerRotation ( const MEulerRotation src)

The copy constructor.

Creates a new euler rotation and initializes it to the same values as the given euler rotation.

Parameters
[in]srcthe euler rotation to copy

Class constructor.

Construct an euler rotation from a vector with the given rotation order.

Parameters
[in]vvector from which to set the x, y, and z rotation components
[in]ordthe rotation order; the default rotation order is XYZ
MEulerRotation ( double  xx,
double  yy,
double  zz,
MEulerRotation::RotationOrder  ord = kXYZ 
)

Class constructor.

Initializes the euler rotation with the explicit x, y, z, and rotation order values provided as arguments.

Parameters
[in]xxthe x component of the euler rotation
[in]yythe y component of the euler rotation
[in]zzthe z component of the euler rotation
[in]ordthe rotation order of the euler rotation; the default rotation order is XYZ

Member Function Documentation

MEulerRotation & operator= ( const MEulerRotation src)

The assignment operator.

Parameters
[in]srcthe source euler rotation
Returns
A reference to the euler rotation that has been assigned to the source euler rotation
MEulerRotation & operator= ( const MQuaternion q)

The assignment operator.

Parameters
[in]qthe source quaternion
Returns
A reference to the euler rotation that has been assigned to the quaternion
MEulerRotation & operator= ( const MMatrix m)

Convert the given 4X4 homogeneous rotation matrix to a euler rotation.

Parameters
[in]mthe matrix to be converted to a euler rotation
Returns
A reference to the euler rotation that has been converted from the rotation matrix
MEulerRotation & operator= ( const MVector v)

The assignment operator.

Parameters
[in]vthe source vector from which the x, y, and z rotation components are set
Returns
A reference to the euler rotation that has been assigned to the source vector
MEulerRotation & setValue ( const MVector v,
MEulerRotation::RotationOrder  ord = kXYZ 
)

Sets the euler rotation to the values contained in the vector and with the specified rotation order.

Parameters
[in]vvector from which to set the x, y, and z rotation components
[in]ordthe rotation order; the default rotation order is XYZ
Returns
A reference to the euler rotation whose value has been set
MEulerRotation & setValue ( double  xx,
double  yy,
double  zz,
MEulerRotation::RotationOrder  ord = kXYZ 
)

Sets the euler rotation to the x, y, and z rotation components with the specified rotation order.

Parameters
[in]xxthe x component of the rotation
[in]yythe y component of the rotation
[in]zzthe z component of the rotation
[in]ordthe rotation order; the default rotation order is XYZ
Returns
A reference to the euler rotation whose value has been set
MQuaternion asQuaternion ( ) const

Converts an euler rotation to a quaternion.

Returns
The quaternion that has been casted from the euler rotation
MMatrix asMatrix ( ) const

Converts an euler rotation to a rotation matrix.

Returns
The rotation matrix that has been casted from the euler rotation
MVector asVector ( ) const

Converts an euler rotation to a vector.

The rotation order component is dropped.

Returns
The vector that has been casted from the euler rotation
Examples:
AbcImport/XformHelper.cpp.
double operator[] ( unsigned int  i) const

The index operator.

If its argument is 0 it will return the x component of the euler rotation. If its argument is 1 it will return the y component of the euler rotation. If its argument is 2 it will return the z component of the euler rotation.

Parameters
[in]ivalue indicating which component to return
Returns
The component of the euler rotation corresponding to the index
MEulerRotation operator+ ( const MEulerRotation other) const

The euler rotation addition operator.

Parameters
[in]otherthe euler rotation to be added to this euler rotation
Returns
The sum of the two euler rotations
MEulerRotation & operator+= ( const MEulerRotation other)

The in place euler rotation addition operator.

Parameters
[in]otherthe euler rotation to be added with this euler rotation
Returns
A reference the euler rotation which has been added to the other euler rotation
MEulerRotation operator- ( const MEulerRotation other) const

The euler rotation subtraction operator.

Parameters
[in]otherthe euler rotation to be subtracted from this euler rotation
Returns
The euler rotation that results from the subtraction
MEulerRotation & operator-= ( const MEulerRotation other)

The in place euler rotation subtraction operator.

Parameters
[in]otherthe euler rotation to be subtracted from this euler rotation
Returns
A reference the euler rotation which has had the other euler rotation subtracted from it
MEulerRotation operator- ( ) const

The unary minus operator.

Negates the value of each of the x, y, and z components of the euler rotation. The order remains the same.

Returns
Euler rotation that results from the negation
MEulerRotation operator* ( const MEulerRotation other) const

The euler rotation multiplication operator.

Parameters
[in]otherthe euler rotation to be multiplied with this euler rotation
Returns
The product of the two euler rotations
MEulerRotation operator* ( const MQuaternion other) const

This quaternion multiplication operator.

Parameters
[in]otherthe quaternion to be multiplied with this euler rotation
Returns
The product of the euler rotation and the quaternion
MEulerRotation operator* ( double  other) const

This scalar multiplication operator.

Parameters
[in]otherthe scalar value to be multiplied with this euler rotation
Returns
The product of the euler rotation and the scalar value
MEulerRotation & operator*= ( const MEulerRotation other)

The in place euler rotation multiplication operator.

Parameters
[in]otherthe euler rotation to be multiplied with this euler rotation
Returns
A reference to the euler rotation which has been multiplied with the other euler rotation
MEulerRotation & operator*= ( const MQuaternion other)

The in place quaternion multiplication operator.

Parameters
[in]otherthe quaternion to be multiplied with this euler rotation
Returns
A reference to the euler rotation which has been multiplied with the quaternion
MEulerRotation & operator*= ( double  other)

The in place scalar multiplication operator.

Parameters
[in]otherthe double to be multiplied with this euler rotation
Returns
A reference to the euler rotation which has been multiplied with the double
bool operator== ( const MEulerRotation other) const

The euler rotation equality operator.

Parameters
[in]otherthe euler rotation to be compared with this euler rotation
Returns
  • true the euler rotations are identical
  • false the euler rotations are not identical
bool operator!= ( const MEulerRotation other) const

The euler rotation inequality operator.

Parameters
[in]otherthe euler rotation to be compared with this euler rotation
Returns
  • true the euler rotations are not identical
  • false the euler rotations are identical
bool isEquivalent ( const MEulerRotation other,
double  tolerance = kEulerRotationEpsilon 
) const

This method returns true if this euler rotation is equivalent, within some given tolerance, to the other euler rotation.

'tolerance' defaults to kEulerRotationEpsilon which is 1.0e-10

Parameters
[in]otherthe euler rotation to be compared with this euler rotation
[in]tolerancethe amount of variation allowed for equivalency
Returns
  • true the euler rotations are equivalent
  • false the euler rotations are not equivalent
bool isZero ( double  tolerance = kEulerRotationEpsilon) const

This method returns true if this euler rotation is zero, within some given tolerance.

'tolerance' defaults to kEulerRotationEpsilon which is 1.0e-10

Parameters
[in]tolerancethe amount of variation allowed for equivalency to zero
Returns
  • true the rotation is zero
  • false the rotation is not zero
MEulerRotation & incrementalRotateBy ( const MVector axis,
double  angle 
)

Perform an incremental rotation by the specified axis and angle.

The rotation is broken down and performed in smaller steps so that the angles update properly.

Parameters
[in]axisthe axis to rotate around
[in]anglethe angle by which to rotate around the axis
Returns
A reference to the euler rotation that has been incrementally rotated
MEulerRotation inverse ( ) const

Returns the inverse of this euler rotation.

The rotation order will be reversed.

Returns
Euler rotation that is the inverse of this euler rotation
MEulerRotation & invertIt ( )

Performs an in place inversion of this euler rotation.

The rotation order will be reversed.

Returns
A reference to the euler rotation that has been inverted

Returns the reordering of this euler rotation, such that the euler rotation will have the specified rotation order.

Parameters
[in]ordthe new rotation order of the euler rotation
Returns
Euler rotation that is the reordering of this euler rotation

Performs an in place reordering of this euler rotation, such that the euler rotation will have the specified rotation order.

Parameters
[in]ordthe new rotation order of the euler rotation
Returns
A reference to the euler rotation that has been reordered
MEulerRotation bound ( ) const

Returns the result of bounding this rotation to be within +/- PI.

Bounding a rotation to be within +/- PI is defined to be the result of offsetting the rotation by +/- 2nPI (term by term) such that the offset is within +/- PI.

Returns
The euler rotation that results from bounding this euler rotation
MEulerRotation & boundIt ( const MEulerRotation src)

Sets this euler rotation to be the input rotation that has been bound to be within +/- PI.

Bounding a rotation to be within +/- PI is defined to be the result of offsetting the rotation by +/- 2nPI (term by term) such that the offset is within +/- PI.

Parameters
[in]srcthe input rotation that will be bound
Returns
A reference to the euler rotation that has been set to the bound input rotation
MEulerRotation & boundIt ( )

Bounds this rotation to be within +/- PI.

Bounding a rotation to be within +/- PI is defined to be the result of offsetting the rotation by +/- 2nPI (term by term) such that the offset is within +/- PI.

Returns
A reference to the euler rotation that has been bound
MEulerRotation alternateSolution ( ) const

Returns an alternate solution to this rotation.

The resulting rotation will be bound between +/- PI, and the rotation order will remain unchanged.

Returns
An alternate solution to this rotation
MEulerRotation & setToAlternateSolution ( const MEulerRotation src)

Sets this euler rotation to an alternate solution of the input rotation.

The resulting rotation will be bound between +/- PI, and the rotation order will remain unchanged.

Parameters
[in]srcthe rotation to compute an alternate solution to
Returns
A reference to the euler rotation that has been set to an alternate solution
MEulerRotation & setToAlternateSolution ( )

Sets this euler rotation to an alternate solution of this rotation.

The resulting rotation will be bound between +/- PI, and the rotation order will remain unchanged.

Returns
A reference to the euler rotation that has been set to an alternate solution
MEulerRotation closestSolution ( const MEulerRotation dst) const

Returns the euler rotation that is the closest solution to the "dst" euler rotation.

Parameters
[in]dstthe euler rotation to which the solution should be closest
Returns
The closest solution to the "dst" rotation
MEulerRotation & setToClosestSolution ( const MEulerRotation src,
const MEulerRotation dst 
)

Sets this euler rotation to the euler rotation that is the closest solution of the "src" euler rotation to the "dst" euler rotation.

Parameters
[in]srcthe euler rotation whose closest solution will be calculated
[in]dstthe euler rotation to which the solution should be closest
Returns
A reference to the euler rotation that has been set to the closest solution
MEulerRotation & setToClosestSolution ( const MEulerRotation dst)

Sets this euler rotation to the euler rotation that is the closest solution to the "dst" euler rotation.

Parameters
[in]dstthe euler rotation to which the solution should be closest
Returns
A reference to the euler rotation that has been set to the closest solution
MEulerRotation closestCut ( const MEulerRotation dst) const

Returns the closest cut of this rotation to "dst".

The closest cut of rotation A to rotation B is defined to be the rotation that is +/- 2nPI to rotation A (term by term) and within +/- PI to rotation B.

Parameters
[in]dstthe range of the closest cut
Returns
The closest cut of this rotation
MEulerRotation & setToClosestCut ( const MEulerRotation src,
const MEulerRotation dst 
)

Sets this rotation to be the closest cut of "src" to "dst".

The closest cut of rotation A to rotation B is defined to be the rotation that is +/- 2nPI to rotation A (term by term) and within +/- PI to rotation B.

Parameters
[in]srcthe euler rotation whose terms will be offset by +/- 2nPI
[in]dstthe range of the closest cut
Returns
A reference to the euler rotation that has been set to the closest cut
MEulerRotation & setToClosestCut ( const MEulerRotation dst)

Sets this rotation to be the closest cut to "dst".

The closest cut of rotation A to rotation B is defined to be the rotation that is +/- 2nPI to rotation A (term by term) and within +/- PI to rotation B.

Parameters
[in]dstthe range of the closest cut
Returns
A reference to the euler rotation that has been set to the closest cut
MEulerRotation decompose ( const MMatrix matrix,
MEulerRotation::RotationOrder  ord 
)
static

Decompose a rotation matrix into the desired euler angles with the specified order.

Parameters
[in]matrixthe matrix that will be decomposed into an euler rotation with the specified order
[in]ordthe order which the euler rotation will have
Returns
The euler rotation that has been decomposed from the rotation matrix
double & operator[] ( unsigned int  i)

NO SCRIPT SUPPORT.

The index operator.

If its argument is 0 it will return the x component of the euler rotation. If its argument is 1 it will return the y component of the euler rotation. If its argument is 2 it will return the z component of the euler rotation.

Parameters
[in]ivalue indicating which component to return
Returns
A reference to the component of the euler rotation corresponding to the index
MEulerRotation bound ( const MEulerRotation src)
static

NO SCRIPT SUPPORT.

Returns the euler rotation that bounds the input rotation to be within +/- PI.

Bounding a rotation to be within +/- PI is defined to be the result of offsetting the rotation by +/- 2nPI (term by term) such that the offset is within +/- PI.

Parameters
[in]srcthe input rotation
Returns
The euler rotation that bounds the input rotation
MEulerRotation alternateSolution ( const MEulerRotation src)
static

NO SCRIPT SUPPORT.

Returns the euler rotation that is an alternate solution of the input rotation.

The resulting rotation will be bound between +/- PI, and the rotation order will remain unchanged.

Parameters
[in]srcthe rotation to compute an alternate solution to
Returns
The alternate solution to the input rotation
MEulerRotation closestSolution ( const MEulerRotation src,
const MEulerRotation dst 
)
static

NO SCRIPT SUPPORT.

Returns the euler rotation that is the closest solution of the "src" euler rotation to the "dst" euler rotation.

Parameters
[in]srcthe euler rotation whose closest solution will be calculated
[in]dstthe euler rotation to which the solution should be closest
Returns
The closest solution of "src" to "dst"
MEulerRotation closestCut ( const MEulerRotation src,
const MEulerRotation dst 
)
static

NO SCRIPT SUPPORT.

Returns the euler rotation that is the closest cut of "src" to "dst".

The closest cut of rotation A to rotation B is defined to be the rotation that is +/- 2nPI to rotation A (term by term) and within +/- PI to rotation B.

Parameters
[in]srcthe euler rotation whose terms will be offset by +/- 2nPI
[in]dstthe range of the closest cut
Returns
The closest cut of "src" to "dst"

Friends And Related Function Documentation

OPENMAYA_EXPORT MEulerRotation operator* ( double  scale,
const MEulerRotation other 
)
friend

NO SCRIPT SUPPORT.

Parameters
[in]scalethe amount by which the euler rotation should be scaled
[in]otherthe euler rotation to which the scale should be applied
Returns
Euler rotation that is the result of scaling the other euler rotation
OPENMAYA_EXPORT std::ostream& operator<< ( std::ostream &  os,
const MEulerRotation rotation 
)
friend

NO SCRIPT SUPPORT.

The format used is [order: order, x: x, y: y, z: z], where x, y, and z are in degrees.

Parameters
[in]osthe ostream to print to
[in]rotationthe euler rotation to be printed x
Returns
The ostream reference, os, provided as the first parameter.

The documentation for this class was generated from the following files: