EulerAngles
EulerAngles is a static storage container which stores a vectors of three double values representing Euler angles, their cosines and sines. It also stores the corresponding Euler convention.
The Euler conventions are set using the dedicated constants:
cppenum EulerConvention{ XZX, XYX, YXY, YZY, ZXZ, ZYZ, /* proper Euler angles*/ XYZ, YZX, ZXY, XZY, ZYX, YXZ, /* Tait–Bryan angles*/ NNN /*default convention -> convention not set*/};
and corresponding strings
cppconst std::vector<std::string>EulerConventionS{ "XZX", "XYX", "YXY", "YZY", "ZXZ", "ZYZ", /* proper Euler angles*/ "XYZ", "YZX", "ZXY", "XZY", "ZYX", "YXZ", /* Tait–Bryan angles*/ "NNN" /*default convention -> convention not set*/};
The data inside of the EulerAngles container is manipulated using a number of dedicated methods:
Accessible storages
cppstd::array<double,3> Q;Three Euler angles.
cppstd::array<double,3> CosQ;Cosines of the stored Euler angles for faster computations.
cppstd::array<double,3> SinQ;Sines of the stored Euler angles for faster computations.
Constructors
cppEulerAngles();Default constructor.
cppEulerAngles(std::initializer_list<double> Angles, EulerConvention locConvention);Constructor, initializes the Euler angles using initializer list and convention.
cppEulerAngles(const EulerAngles& rhs);Copy constructor. Initializes current container with the copy of the
rhs.
Arithmetic and logic operations
cppEulerAngles& operator=(const EulerAngles& rhs);Assignment operator.
cppEulerAngles operator+(const EulerAngles& rhs) const;Returns the sum of two Euler angles.
cppEulerAngles operator-(const EulerAngles& rhs) const;Returns the difference of two Euler angles.
cppEulerAngles& operator+=(const EulerAngles& rhs);Adds rhs to the current Euler angles.
cppEulerAngles& operator-=(const EulerAngles& rhs);Subtracts rhs from the current Euler angles.
cppEulerAngles operator* (const double rhs) const;Returns Euler angles multiplied by the specified factor.
cppEulerAngles& operator*=(const double rhs);Multiplies current Euler angles by the specified factor.
cppbool operator==(const EulerAngles& rhs);Comparison operator. Returns true if two EulerAngles are of the same convention and their values are within DBL_EPSILON from one another.
Data access and manipulation methods
cppvoid set(const double q1, const double q2, const double q3, EulerConvention locConvention);Sets Euler angles to the specified values following given convention.
cppvoid setTrigonometricFunctions();Sets internal sines and cosines of Euler angles for faster computations.
cppvoid set_to_zero(void);Sets Euler angles to zero.
cppvoid set_convention(const EulerConvention locConvention);Sets Euler angle convention.
cppvoid set(dMatrix3x3 RotMatrix, EulerConvention locConvention);Sets Euler angles form the rotation matrix using given convention.
cppvoid set(Quaternion Quat, EulerConvention locConvention, const bool active = true);Sets Euler angles from the quaternion using specified convention and type of rotation (active/passive).
cppvoid set(dVector3 Axis, const double Angle);Sets Euler angles from axis-angle entries.
cppvoid add(const double q1, const double q2, const double q3);Adds specified values to the corresponding Euler angles.
cppEulerAngles get_degree(void) const;Returns Euler angles in degrees.
cppstd::string get_convention(void) const;Returns Euler angle convention.
cppstatic EulerConvention to_EulerConvention(const std::string& s);Converts Euler angles' convention string to the corresponding enum entry.
cppdMatrix3x3 getRotationMatrix() const;Returns rotation matrix corresponding to Euler angles.
cppQuaternion getQuaternion(const bool Active = true) const;Returns quaternion corresponding to Euler angles considering rotation type (active/passive).
cppvoid getAxisAngle(dVector3& Axis, double& Angle);Returns axis-angle representation of the stored Euler angles.
Read/write methods
cppstd::string print(void) const;Returns formatted string containing Euler angles and corresponding convention.
cppstd::string print_degree(void) const;Returns formatted string containing Euler angles and corresponding convention in degrees.
cppstd::string print_entire(void) const;Returns formatted string containing full container content.