#include <xsi_rotation.h>
Provides conversion facilities for various rotation representations including Euler angles, Quaternion, Axis angle and rotation matrix.
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() ) );
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 |
enum RotationOrder |
Defines the rotation order of a rotation for the Euler angles representation.
CRotation | ( | ) |
Default constructor.
Copy constructor.
in_rotation | Rotation to copy |
CRotation | ( | const CVector3 & | in_EulerAngles, |
RotationOrder | in_RotOrder =
siXYZ |
||
) |
Constructor (from CVector3 of Euler angles).
in_EulerAngles | Euler angles to construct from |
in_RotOrder | Rotation order to use |
CRotation | ( | double | in_dX, |
double | in_dY, | ||
double | in_dZ, | ||
RotationOrder | in_RotOrder =
siXYZ |
||
) |
Constructor (from XYZ Euler angles).
in_dX | X angle |
in_dY | Y angle |
in_dZ | Z angle |
in_RotOrder | Rotation order to use |
CRotation | ( | const CQuaternion & | in_Quat | ) |
Constructor (from a quaternion).
in_Quat | Quaternion to construct from |
Constructor (using axis angle representation).
in_Axis | Axis of rotation |
in_dAngle | Rotation angle around the axis |
Constructor (from a rotation matrix).
in_Matrix | Rotation matrix |
~CRotation | ( | ) |
Default destructor.
Assignment operator.
in_rotation | Rotation to copy |
Copies the content of another rotation.
in_SrcRot | Rotation to copy |
CVector3 GetXYZAngles | ( | ) | const |
void GetXYZAngles | ( | double & | io_dX, |
double & | io_dY, | ||
double & | io_dZ | ||
) | const |
Returns the Euler angles's representation of the rotation.
io_dX | X angle |
io_dY | Y angle |
io_dZ | Z angle |
RotationOrder GetRotationOrder | ( | ) | const |
Returns the rotation order of this rotation for the Euler angles representation.
void PutRotationOrder | ( | RotationOrder | in_RotationOrder | ) |
Sets the rotation order for the Euler angles representation.
in_RotationOrder | New rotation order to use |
CRotation& SetFromXYZAngles | ( | const CVector3 & | in_EulerAngles, |
RotationOrder | in_Order =
siXYZ |
||
) |
Sets the current rotation from Euler angles.
in_EulerAngles | Vector containing the rotation angles |
in_Order | Rotation order |
CRotation& SetFromXYZAngles | ( | double | in_dX, |
double | in_dY, | ||
double | in_dZ, | ||
RotationOrder | in_Order =
siXYZ |
||
) |
Sets the rotation from Euler angles.
in_dX | X angle |
in_dY | Y angle |
in_dZ | Z angle |
in_Order | Requested rotation order |
CRotation& SetFromXYZAxes | ( | const CVector3 & | in_XAxis, |
const CVector3 & | in_YAxis, | ||
const CVector3 & | in_ZAxis | ||
) |
Sets this rotation from three orthonormal axes.
in_XAxis | The X axis |
in_YAxis | The Y axis |
in_ZAxis | The Z axis |
Multiplies this rotation with another one in place.
in_Rotation | Rotation to multiply |
Multiplies this rotation with another one in place.
in_Rotation | Rotation to multiply |
Stores the result of the multiplication of two rotations.
in_Rotation1 | First rotation |
in_Rotation2 | Second rotation |
CRotation& InvertInPlace | ( | ) |
Stores the invert of a rotation.
in_Rot | Rotation to invert |
CQuaternion GetQuaternion | ( | ) | const |
Returns the quaternion representation of the rotation.
CRotation& SetFromQuaternion | ( | const CQuaternion & | in_Quat | ) |
Sets the rotation from a quaternion.
in_Quat | Quaternion to set from |
CRotation& operator= | ( | const CQuaternion & | in_Quat | ) |
Sets the rotation from a quaternion.
in_Quat | Quaternion to set from |
CVector3 GetAxisAngle | ( | double & | io_dAngle | ) | const |
Returns the axis angle representation of the rotation.
io_dAngle | Rotation angle around the axis |
Sets the rotation from an axis angle.
in_Axis | Axis of rotation |
in_dAngle | Rotation angle around the axis |
CMatrix3 GetMatrix | ( | ) | const |
Sets the rotation from a rotation matrix.
in_Matrix | Rotation matrix |
Sets the rotation from a rotation matrix.
in_Matrix | Rotation matrix |
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.
in_Rot | Rotation to compare against |
in_dEpsilon | Tolerance. Rotations are considered equal if each parameter pair has a difference lower than in_dEpsilon. |
bool Equals | ( | const CRotation & | in_Rot | ) | const |
Performs exact comparison of two quaternions.
in_Rot | Rotation to compare against |
bool operator== | ( | const CRotation & | in_Rot | ) | const |
Performs exact comparison of two quaternions.
in_Rot | Rotation to compare against |
bool operator!= | ( | const CRotation & | in_Rot | ) | const |
Inequality operator tests the strict inequality of this rotation with the rotation in_rotation.
in_Rot | Operand rotation. |