Public Types | Public Member Functions
CRotation Class Reference

Detailed Description

Provides conversion facilities for various rotation representations including Euler angles, Quaternion, Axis angle and rotation matrix.

Note:
All angle values are expressed in radians.
See also:
CTransformation, CQuaternion
Example:
        using namespace XSI;
        using namespace MATH;

        Application app;
        Model root = app.GetActiveSceneRoot();

        // Create a cube
        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube );

        // Rotate it 60 degrees
        KinematicState  cubeKine = myCube.GetKinematics().GetGlobal();
        cubeKine.PutParameterValue( L"rotx", 60.0 );

        // Get the current rotation for the cube
        CRotation cubeRotation = cubeKine.GetTransform().GetRotation();

        // Halve the current rotation angle values
        CVector3 eulerAngles = cubeRotation.GetXYZAngles();
        eulerAngles.ScaleInPlace( 0.5 );

        // Put the halved value back into x
        cubeKine.PutParameterValue( L"rotx", RadiansToDegrees( eulerAngles.GetX() ) );

#include <xsi_rotation.h>

List of all members.

Public Types

enum   RotationOrder {
  siXYZ = 0,
  siXZY = 1,
  siYXZ = 2,
  siYZX = 3,
  siZXY = 4,
  siZYX = 5
}

Public Member Functions

  CRotation ()
  CRotation (const CRotation &in_rotation)
  CRotation (const CVector3 &in_EulerAngles, RotationOrder in_RotOrder=siXYZ)
  CRotation (double in_dX, double in_dY, double in_dZ, RotationOrder in_RotOrder=siXYZ)
  CRotation (const CQuaternion &in_Quat)
  CRotation (const CVector3 &in_Axis, double in_dAngle)
  CRotation (const CMatrix3 &in_Matrix)
  ~CRotation ()
CRotation operator= (const CRotation &in_rotation)
CRotation Copy (const CRotation &in_SrcRot)
CVector3  GetXYZAngles () const
void  GetXYZAngles (double &io_dX, double &io_dY, double &io_dZ) const
RotationOrder  GetRotationOrder () const
void  PutRotationOrder (RotationOrder in_RotationOrder)
CRotation SetFromXYZAngles (const CVector3 &in_EulerAngles, RotationOrder in_Order=siXYZ)
CRotation SetFromXYZAngles (double in_dX, double in_dY, double in_dZ, RotationOrder in_Order=siXYZ)
CRotation SetFromXYZAxes (const CVector3 &in_XAxis, const CVector3 &in_YAxis, const CVector3 &in_ZAxis)
CRotation operator*= (const CRotation &in_Rotation)
CRotation MulInPlace (const CRotation &in_Rotation)
CRotation Mul (const CRotation &in_Rotation1, const CRotation &in_Rotation2)
CRotation InvertInPlace ()
CRotation Invert (const CRotation &in_Rot)
CQuaternion  GetQuaternion () const
CRotation SetFromQuaternion (const CQuaternion &in_Quat)
CRotation operator= (const CQuaternion &in_Quat)
CVector3  GetAxisAngle (double &io_dAngle) const
CRotation SetFromAxisAngle (const CVector3 &in_Axis, double in_dAngle)
CMatrix3  GetMatrix () const
CRotation SetFromMatrix (const CMatrix3 &in_Matrix)
CRotation operator= (const CMatrix3 &in_Matrix)
void  SetIdentity ()
bool  EpsilonEquals (const CRotation &in_Rot, double in_dEpsilon) const
bool  Equals (const CRotation &in_Rot) const
bool  operator== (const CRotation &in_Rot) const
bool  operator!= (const CRotation &in_Rot) const

Member Enumeration Documentation

Defines the rotation order of a rotation for the Euler angles representation.

Enumerator:
siXYZ 

X, Y, Z order

siXZY 

X, Z, Y order

siYXZ 

Y, X, Z order

siYZX 

Y, Z, X order

siZXY 

Z, X, Y order

siZYX 

Z, Y, X order


Constructor & Destructor Documentation

CRotation ( )

Default constructor.

CRotation ( const CRotation in_rotation )

Copy constructor.

Parameters:
in_rotation Rotation to copy
CRotation ( const CVector3 in_EulerAngles,
RotationOrder  in_RotOrder = siXYZ 
)

Constructor (from CVector3 of Euler angles).

Parameters:
in_EulerAngles Euler angles to construct from
in_RotOrder Rotation order to use
See also:
CRotation::SetFromXYZAngles, CRotation::PutRotationOrder
CRotation ( double  in_dX,
double  in_dY,
double  in_dZ,
RotationOrder  in_RotOrder = siXYZ 
)

Constructor (from XYZ Euler angles).

Parameters:
in_dX X angle
in_dY Y angle
in_dZ Z angle
in_RotOrder Rotation order to use
See also:
CRotation::SetFromXYZAngles, CRotation::PutRotationOrder
CRotation ( const CQuaternion in_Quat )

Constructor (from a quaternion).

Parameters:
in_Quat Quaternion to construct from
See also:
CRotation::GetQuaternion, CRotation::SetFromQuaternion
CRotation ( const CVector3 in_Axis,
double  in_dAngle 
)

Constructor (using axis angle representation).

Parameters:
in_Axis Axis of rotation
in_dAngle Rotation angle around the axis
See also:
CRotation::GetAxisAngle, CRotation::SetFromAxisAngle
CRotation ( const CMatrix3 in_Matrix )

Constructor (from a rotation matrix).

Parameters:
in_Matrix Rotation matrix
See also:
CRotation::GetMatrix, CRotation::SetFromMatrix
~CRotation ( )

Default destructor.


Member Function Documentation

CRotation& operator= ( const CRotation in_rotation )

Assignment operator.

Parameters:
in_rotation Rotation to copy
Returns:
A reference to this rotation.
CRotation& Copy ( const CRotation in_SrcRot )

Copies the content of another rotation.

Parameters:
in_SrcRot Rotation to copy
Returns:
This rotation
CVector3 GetXYZAngles ( ) const

Returns the Euler angles representation of the rotation as a CVector3.

Returns:
CVector3 Vector containing the X, Y and Z Euler angles
See also:
CRotation::SetFromXYZAngles, CRotation::GetRotationOrder
void GetXYZAngles ( double &  io_dX,
double &  io_dY,
double &  io_dZ 
) const

Returns the Euler angles's representation of the rotation.

Parameters:
io_dX X angle
io_dY Y angle
io_dZ Z angle
See also:
CRotation::SetFromXYZAngles, CRotation::GetRotationOrder
RotationOrder GetRotationOrder ( ) const

Returns the rotation order of this rotation for the Euler angles representation.

Returns:
CRotation::RotationOrder
void PutRotationOrder ( RotationOrder  in_RotationOrder )

Sets the rotation order for the Euler angles representation.

Parameters:
in_RotationOrder New rotation order to use
See also:
CRotation::GetRotationOrder
CRotation& SetFromXYZAngles ( const CVector3 in_EulerAngles,
RotationOrder  in_Order = siXYZ 
)

Sets the current rotation from Euler angles.

Parameters:
in_EulerAngles Vector containing the rotation angles
in_Order Rotation order
Returns:
This rotation
See also:
CRotation::GetXYZAngles, CRotation::PutRotationOrder
CRotation& SetFromXYZAngles ( double  in_dX,
double  in_dY,
double  in_dZ,
RotationOrder  in_Order = siXYZ 
)

Sets the rotation from Euler angles.

Parameters:
in_dX X angle
in_dY Y angle
in_dZ Z angle
in_Order Requested rotation order
Returns:
This rotation
See also:
CRotation::GetXYZAngles, CRotation::PutRotationOrder
CRotation& SetFromXYZAxes ( const CVector3 in_XAxis,
const CVector3 in_YAxis,
const CVector3 in_ZAxis 
)

Sets this rotation from three orthonormal axes.

Warning:
No verification is performed about their orthonormality
Parameters:
in_XAxis The X axis
in_YAxis The Y axis
in_ZAxis The Z axis
Returns:
This rotation
CRotation& operator*= ( const CRotation in_Rotation )

Multiplies this rotation with another one in place.

Parameters:
in_Rotation Rotation to multiply
Returns:
This rotation
CRotation& MulInPlace ( const CRotation in_Rotation )

Multiplies this rotation with another one in place.

Parameters:
in_Rotation Rotation to multiply
Returns:
This rotation
CRotation& Mul ( const CRotation in_Rotation1,
const CRotation in_Rotation2 
)

Stores the result of the multiplication of two rotations.

Parameters:
in_Rotation1 First rotation
in_Rotation2 Second rotation
Returns:
This rotation
CRotation& InvertInPlace ( )

Inverts the rotation in place.

Returns:
This rotation
CRotation& Invert ( const CRotation in_Rot )

Stores the invert of a rotation.

Parameters:
in_Rot Rotation to invert
Returns:
This rotation
CQuaternion GetQuaternion ( ) const

Returns the quaternion representation of the rotation.

Returns:
CQuaternion
See also:
CRotation::SetFromQuaternion
CRotation& SetFromQuaternion ( const CQuaternion in_Quat )

Sets the rotation from a quaternion.

Parameters:
in_Quat Quaternion to set from
Returns:
This rotation
See also:
CRotation::GetQuaternion
CRotation& operator= ( const CQuaternion in_Quat )

Sets the rotation from a quaternion.

Parameters:
in_Quat Quaternion to set from
Returns:
This rotation
See also:
CRotation::SetFromQuaternion
CVector3 GetAxisAngle ( double &  io_dAngle ) const

Returns the axis angle representation of the rotation.

Parameters:
io_dAngle Rotation angle around the axis
Returns:
CVector3 Axis of rotation
See also:
CRotation::SetFromAxisAngle
CRotation& SetFromAxisAngle ( const CVector3 in_Axis,
double  in_dAngle 
)

Sets the rotation from an axis angle.

Parameters:
in_Axis Axis of rotation
in_dAngle Rotation angle around the axis
Returns:
This rotation
See also:
CRotation::GetAxisAngle
CMatrix3 GetMatrix ( ) const

Returns the rotation matrix.

Returns:
CMatrix3
See also:
CRotation::SetFromMatrix
CRotation& SetFromMatrix ( const CMatrix3 in_Matrix )

Sets the rotation from a rotation matrix.

Parameters:
in_Matrix Rotation matrix
Returns:
This rotation
See also:
CRotation::GetMatrix
CRotation& operator= ( const CMatrix3 in_Matrix )

Sets the rotation from a rotation matrix.

Parameters:
in_Matrix Rotation matrix
Returns:
This rotation
See also:
CRotation::SetFromMatrix
void SetIdentity ( )

Sets the rotation to identity rotation.

bool EpsilonEquals ( const CRotation in_Rot,
double  in_dEpsilon 
) const

Tests the equality of this rotation against in_Rot, with a tolerance of in_dEpsilon.

Parameters:
in_Rot Rotation to compare against
in_dEpsilon Tolerance. Rotations are considered equal if each parameter pair has a difference lower than in_dEpsilon.
Returns:
true if rotations are approximately equal; false if not equal
See also:
CRotation::Equals
bool Equals ( const CRotation in_Rot ) const

Performs exact comparison of two quaternions.

Note:
Each parameter of both quaternions must be exactly the same for a match.
Parameters:
in_Rot Rotation to compare against
See also:
CRotation::EpsilonEquals
bool operator== ( const CRotation in_Rot ) const

Performs exact comparison of two quaternions.

Note:
Each parameter of both quaternions must be exactly the same for a match.
Parameters:
in_Rot Rotation to compare against
See also:
CRotation::EpsilonEquals, CRotation::Equals
bool operator!= ( const CRotation in_Rot ) const

Inequality operator tests the strict inequality of this rotation with the rotation in_rotation.

Parameters:
in_Rot Operand rotation.
Returns:
true if equal else false.
See also:
CRotation::Equals

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