Base::Rotation Class Reference

#include <Rotation.h>

Public Types

enum  EulerSequence {
  Invalid , EulerAngles , YawPitchRoll , Extrinsic_XYZ ,
  Extrinsic_XZY , Extrinsic_YZX , Extrinsic_YXZ , Extrinsic_ZXY ,
  Extrinsic_ZYX , Intrinsic_XYZ , Intrinsic_XZY , Intrinsic_YZX ,
  Intrinsic_YXZ , Intrinsic_ZXY , Intrinsic_ZYX , Extrinsic_XYX ,
  Extrinsic_XZX , Extrinsic_YZY , Extrinsic_YXY , Extrinsic_ZYZ ,
  Extrinsic_ZXZ , Intrinsic_XYX , Intrinsic_XZX , Intrinsic_YZY ,
  Intrinsic_YXY , Intrinsic_ZXZ , Intrinsic_ZYZ , EulerSequenceLast
}
 

Public Member Functions

void getEulerAngles (EulerSequence seq, double &alpha, double &beta, double &gamma) const
 
void getRawValue (Vector3d &axis, double &rfAngle) const
 Does the same as the method above unless normalizing the axis. More...
 
const double * getValue () const
 Methods to get or set rotations. More...
 
void getValue (double &q0, double &q1, double &q2, double &q3) const
 
void getValue (Matrix4D &matrix) const
 Returns this rotation in form of a matrix. More...
 
void getValue (Vector3d &axis, double &rfAngle) const
 If not a null quaternion then axis will be normalized. More...
 
void getYawPitchRoll (double &y, double &p, double &r) const
 Euler angles in yaw,pitch,roll notation. More...
 
Rotation inverse () const
 
Rotationinvert ()
 Invert rotations. More...
 
bool isIdentity () const
 
bool isNull () const
 
bool isSame (const Rotation &) const
 
bool isSame (const Rotation &, double tol) const
 
Vector3d multVec (const Vector3d &src) const
 
void multVec (const Vector3d &src, Vector3d &dst) const
 
bool operator!= (const Rotation &q) const
 
Rotation operator* (const Rotation &q) const
 
Rotationoperator*= (const Rotation &q)
 Operators. More...
 
void operator= (const Rotation &)
 
bool operator== (const Rotation &q) const
 
double & operator[] (unsigned short usIndex)
 
const double & operator[] (unsigned short usIndex) const
 
 Rotation ()
 Construction. More...
 
 Rotation (const double q0, const double q1, const double q2, const double q3)
 Construct a rotation initialized with the given quaternion components: q0 = x, q1 = y, q2 = z and q3 = w, where the quaternion is specified by q=w+xi+yj+zk. More...
 
 Rotation (const double q[4])
 Construct a rotation initialized with the given quaternion components: q[0] = x, q[1] = y, q[2] = z and q[3] = w, where the quaternion is specified by q=w+xi+yj+zk. More...
 
 Rotation (const Matrix4D &matrix)
 
 Rotation (const Rotation &rot)
 
 Rotation (const Vector3d &axis, const double fAngle)
 Construct a rotation by rotation axis and angle. More...
 
 Rotation (const Vector3d &rotateFrom, const Vector3d &rotateTo)
 
void scaleAngle (const double scaleFactor)
 
void setEulerAngles (EulerSequence seq, double alpha, double beta, double gamma)
 
void setValue (const double q0, const double q1, const double q2, const double q3)
 
void setValue (const double q[4])
 
void setValue (const Matrix4D &matrix)
 
void setValue (const Vector3d &axis, const double fAngle)
 
void setValue (const Vector3d &rotateFrom, const Vector3d &rotateTo)
 
void setYawPitchRoll (double y, double p, double r)
 Euler angles in yaw,pitch,roll notation. More...
 

Static Public Member Functions

static EulerSequence eulerSequenceFromName (const char *name)
 
static const char * eulerSequenceName (EulerSequence seq)
 
static Rotation identity ()
 
static Rotation makeRotationByAxes (Vector3d xdir, Vector3d ydir, Vector3d zdir, const char *priorityOrder="ZXY")
 makeRotationByAxes(xdir, ydir, zdir, priorityOrder): creates a rotation that converts a vector in local cs with axes given as arguments, into a vector in global cs. More...
 
static Rotation slerp (const Rotation &rot0, const Rotation &rot1, double t)
 Specialty constructors. More...
 

Member Enumeration Documentation

◆ EulerSequence

Enumerator
Invalid 
EulerAngles 

Classic Euler angles, alias to Intrinsic_ZXZ.

YawPitchRoll 

Yaw Pitch Roll (or nautical) angles, alias to Intrinsic_ZYX.

Extrinsic_XYZ 
Extrinsic_XZY 
Extrinsic_YZX 
Extrinsic_YXZ 
Extrinsic_ZXY 
Extrinsic_ZYX 
Intrinsic_XYZ 
Intrinsic_XZY 
Intrinsic_YZX 
Intrinsic_YXZ 
Intrinsic_ZXY 
Intrinsic_ZYX 
Extrinsic_XYX 
Extrinsic_XZX 
Extrinsic_YZY 
Extrinsic_YXY 
Extrinsic_ZYZ 
Extrinsic_ZXZ 
Intrinsic_XYX 
Intrinsic_XZX 
Intrinsic_YZY 
Intrinsic_YXY 
Intrinsic_ZXZ 
Intrinsic_ZYZ 
EulerSequenceLast 

Constructor & Destructor Documentation

◆ Rotation() [1/7]

Rotation::Rotation ( )

Construction.

Referenced by identity(), makeRotationByAxes(), and slerp().

◆ Rotation() [2/7]

Rotation::Rotation ( const Vector3d axis,
const double  fAngle 
)

Construct a rotation by rotation axis and angle.

References setValue().

◆ Rotation() [3/7]

Rotation::Rotation ( const Matrix4D matrix)

References setValue().

◆ Rotation() [4/7]

Rotation::Rotation ( const double  q[4])

Construct a rotation initialized with the given quaternion components: q[0] = x, q[1] = y, q[2] = z and q[3] = w, where the quaternion is specified by q=w+xi+yj+zk.

References setValue().

◆ Rotation() [5/7]

Rotation::Rotation ( const double  q0,
const double  q1,
const double  q2,
const double  q3 
)

Construct a rotation initialized with the given quaternion components: q0 = x, q1 = y, q2 = z and q3 = w, where the quaternion is specified by q=w+xi+yj+zk.

References setValue().

◆ Rotation() [6/7]

Rotation::Rotation ( const Vector3d rotateFrom,
const Vector3d rotateTo 
)

References setValue().

◆ Rotation() [7/7]

Rotation::Rotation ( const Rotation rot)

Member Function Documentation

◆ eulerSequenceFromName()

Rotation::EulerSequence Rotation::eulerSequenceFromName ( const char *  name)
static

References Invalid.

◆ eulerSequenceName()

const char * Rotation::eulerSequenceName ( EulerSequence  seq)
static

References EulerSequenceLast, and Invalid.

◆ getEulerAngles()

void Rotation::getEulerAngles ( EulerSequence  seq,
double &  alpha,
double &  beta,
double &  gamma 
) const

References getValue().

◆ getRawValue()

void Rotation::getRawValue ( Vector3d axis,
double &  rfAngle 
) const

Does the same as the method above unless normalizing the axis.

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

◆ getValue() [1/4]

◆ getValue() [2/4]

void Rotation::getValue ( double &  q0,
double &  q1,
double &  q2,
double &  q3 
) const

◆ getValue() [3/4]

void Rotation::getValue ( Matrix4D matrix) const

Returns this rotation in form of a matrix.

◆ getValue() [4/4]

void Rotation::getValue ( Vector3d axis,
double &  rfAngle 
) const

◆ getYawPitchRoll()

void Rotation::getYawPitchRoll ( double &  y,
double &  p,
double &  r 
) const

◆ identity()

Rotation Rotation::identity ( )
static

References Rotation().

◆ inverse()

Rotation Rotation::inverse ( ) const

◆ invert()

◆ isIdentity()

◆ isNull()

bool Rotation::isNull ( ) const

◆ isSame() [1/2]

bool Rotation::isSame ( const Rotation q) const

◆ isSame() [2/2]

bool Rotation::isSame ( const Rotation q,
double  tol 
) const

◆ makeRotationByAxes()

Rotation Rotation::makeRotationByAxes ( Vector3d  xdir,
Vector3d  ydir,
Vector3d  zdir,
const char *  priorityOrder = "ZXY" 
)
static

makeRotationByAxes(xdir, ydir, zdir, priorityOrder): creates a rotation that converts a vector in local cs with axes given as arguments, into a vector in global cs.

Parameters
xdiris wanted direction of local X axis
ydir...
zdir
priorityOrdersets which directions are followed. It is a string like "ZXY". This means, Z direction is followed precisely; X direction is corrected to be perpendicular to Z direction, and used; Y direction argument is ignored altogether (Y direction is generated from Z and X).

If only one vector provided is nonzero, the other two directions are picked automatically.

References Base::Vector3< _Precision >::Cross(), Base::Vector3< _Precision >::Length(), Base::Vector3< _Precision >::Normalize(), Rotation(), Base::Matrix4D::setToUnity(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

Referenced by Attacher::AttachEngine3D::calculateAttachedPlacement().

◆ multVec() [1/2]

Vector3d Rotation::multVec ( const Vector3d src) const

References multVec().

◆ multVec() [2/2]

◆ operator!=()

bool Rotation::operator!= ( const Rotation q) const

◆ operator*()

Rotation Rotation::operator* ( const Rotation q) const

◆ operator*=()

Rotation & Rotation::operator*= ( const Rotation q)

Operators.

References getValue(), and setValue().

◆ operator=()

void Rotation::operator= ( const Rotation rot)

◆ operator==()

bool Rotation::operator== ( const Rotation q) const

◆ operator[]() [1/2]

double & Base::Rotation::operator[] ( unsigned short  usIndex)

◆ operator[]() [2/2]

const double & Base::Rotation::operator[] ( unsigned short  usIndex) const

◆ scaleAngle()

void Rotation::scaleAngle ( const double  scaleFactor)

References getValue(), and setValue().

◆ setEulerAngles()

void Rotation::setEulerAngles ( EulerSequence  seq,
double  alpha,
double  beta,
double  gamma 
)

References EulerSequenceLast, and Invalid.

◆ setValue() [1/5]

void Rotation::setValue ( const double  q0,
const double  q1,
const double  q2,
const double  q3 
)

◆ setValue() [2/5]

void Rotation::setValue ( const double  q[4])

◆ setValue() [3/5]

void Rotation::setValue ( const Matrix4D matrix)

◆ setValue() [4/5]

◆ setValue() [5/5]

◆ setYawPitchRoll()

void Rotation::setYawPitchRoll ( double  y,
double  p,
double  r 
)

Euler angles in yaw,pitch,roll notation.

References setValue().

Referenced by Path::Command::getPlacement(), and Path::yawPitchRoll().

◆ slerp()

Rotation Rotation::slerp ( const Rotation rot0,
const Rotation rot1,
double  t 
)
static

Specialty constructors.

References Base::Vector3< double >::epsilon(), DraftVecUtils::neg(), and Rotation().

Referenced by Base::Placement::slerp().


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