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 ()
CRotationoperator= (const CRotation &in_rotation)
CRotationCopy (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)
CRotationSetFromXYZAngles (const CVector3 &in_EulerAngles, RotationOrder in_Order=siXYZ)
CRotationSetFromXYZAngles (double in_dX, double in_dY, double in_dZ, RotationOrder in_Order=siXYZ)
CRotationSetFromXYZAxes (const CVector3 &in_XAxis, const CVector3 &in_YAxis, const CVector3 &in_ZAxis)
CRotationoperator*= (const CRotation &in_Rotation)
CRotationMulInPlace (const CRotation &in_Rotation)
CRotationMul (const CRotation &in_Rotation1, const CRotation &in_Rotation2)
CRotationInvertInPlace ()
CRotationInvert (const CRotation &in_Rot)
CQuaternion GetQuaternion () const
CRotationSetFromQuaternion (const CQuaternion &in_Quat)
CRotationoperator= (const CQuaternion &in_Quat)
CVector3 GetAxisAngle (double &io_dAngle) const
CRotationSetFromAxisAngle (const CVector3 &in_Axis, double in_dAngle)
CMatrix3 GetMatrix () const
CRotationSetFromMatrix (const CMatrix3 &in_Matrix)
CRotationoperator= (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_rotationRotation to copy
CRotation ( const CVector3 in_EulerAngles,
RotationOrder  in_RotOrder = siXYZ 
)

Constructor (from CVector3 of Euler angles).

Parameters:
in_EulerAnglesEuler angles to construct from
in_RotOrderRotation 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_dXX angle
in_dYY angle
in_dZZ angle
in_RotOrderRotation order to use
See also:
CRotation::SetFromXYZAngles, CRotation::PutRotationOrder
CRotation ( const CQuaternion in_Quat)

Constructor (from a quaternion).

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

Constructor (using axis angle representation).

Parameters:
in_AxisAxis of rotation
in_dAngleRotation angle around the axis
See also:
CRotation::GetAxisAngle, CRotation::SetFromAxisAngle
CRotation ( const CMatrix3 in_Matrix)

Constructor (from a rotation matrix).

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

Default destructor.


Member Function Documentation

CRotation& operator= ( const CRotation in_rotation)

Assignment operator.

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

Copies the content of another rotation.

Parameters:
in_SrcRotRotation 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_dXX angle
io_dYY angle
io_dZZ 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_RotationOrderNew 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_EulerAnglesVector containing the rotation angles
in_OrderRotation 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_dXX angle
in_dYY angle
in_dZZ angle
in_OrderRequested 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_XAxisThe X axis
in_YAxisThe Y axis
in_ZAxisThe Z axis
Returns:
This rotation
CRotation& operator*= ( const CRotation in_Rotation)

Multiplies this rotation with another one in place.

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

Multiplies this rotation with another one in place.

Parameters:
in_RotationRotation 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_Rotation1First rotation
in_Rotation2Second 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_RotRotation 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_QuatQuaternion to set from
Returns:
This rotation
See also:
CRotation::GetQuaternion
CRotation& operator= ( const CQuaternion in_Quat)

Sets the rotation from a quaternion.

Parameters:
in_QuatQuaternion 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_dAngleRotation 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_AxisAxis of rotation
in_dAngleRotation 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_MatrixRotation matrix
Returns:
This rotation
See also:
CRotation::GetMatrix
CRotation& operator= ( const CMatrix3 in_Matrix)

Sets the rotation from a rotation matrix.

Parameters:
in_MatrixRotation 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_RotRotation to compare against
in_dEpsilonTolerance. 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_RotRotation 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_RotRotation 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_RotOperand rotation.
Returns:
true if equal else false.
See also:
CRotation::Equals

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