73 #define AGX_EULER_AXES() const int axes[4] = {0,1,2,0}
74 #define AGX_EULER_PAXES() const int paxes[4] = {1,2,0,1};
83 inline int firstAxis()
const {
84 return ( m_c >> 3 )&3;
89 const static char *names[];
95 int getConvention()
const;
113 return ( m_c >> 2 )&1;
116 return ( m_c >> 1 )&1;
118 inline int i()
const {
120 return axes[firstAxis()];
122 inline int j()
const {
124 return paxes[i()+isOdd()];
126 inline int k()
const {
128 return paxes[i()+!isOdd()];
140 enum Axes {X, Y, Z, W};
165 inline Real& operator [] (
size_t i);
170 inline Real operator [] (
size_t i)
const;
176 inline void set(
const Vec3& angles );
182 inline void set(
Real x,
188 EulerAngles::EulerOrder& getOrder();
191 const EulerAngles::EulerOrder& getOrder()
const;
218 template <
typename T>
222 template <
typename T>
305 const Real* ptr()
const;
375 m_angles[0] = angles[0];
376 m_angles[1] = angles[1];
377 m_angles[2] = angles[2];
390 os <<
"[" << e[0] <<
" " << e[1] <<
" " << e[2] <<
"]";
#define AGX_EULER_PAXES()
bool isStatic() const
The computational routines used by the EulerAngle class.
bool operator=(const EulerConvention::Convention &c)
Assignment operator.
EulerOrder(EulerConvention::Convention=EulerConvention::DEFAULT_CONVENTION)
Default constructor: EulerConvention::DEFAULT_CONVENTION convention and 0 angles.
int getConvention() const
Get the current convention.
bool operator=(const int &c)
Assignment operator and conversion from int.
This class provides conversion services between Euler angles in any of the 24 conventions and corresp...
EulerAngles(EulerConvention::Convention C=EulerConvention::DEFAULT_CONVENTION)
Default constructor.
EulerAngles & set(const OrthoMatrix3x3 &m, EulerConvention::Convention C=EulerConvention::BAD)
bool get(Quat &q) const
Compute the value of quaternion q that corresponds to current angles in current convention.
EulerAngles & set(const Matrix4x4T< T > &m, EulerConvention::Convention c=EulerConvention::BAD)
Compute Jacobian matrix between angular velocity in body coordinates and rate of change of angles.
EulerAngles & set(const Quat &q, EulerConvention::Convention C=EulerConvention::BAD)
Set the angles to correspond to quaternion q in given convention.
EulerAngles & operator=(const EulerAngles &e)=default
Assignment operator.
bool get(Matrix4x4T< T > &m) const
Compute the value of matrix m that corresponds to current angles in current convention.
bool get(OrthoMatrix3x3 &m) const
Real x() const
Get the first angle.
Real & operator[](size_t i)
Get an element by index as a reference.
Real y() const
Get the second angle.
EulerAngles(Real a, Real b, Real c, int C)
Explicit constructor.
void set(const Vec3 &angles)
Set the three angles in one call.
EulerAngles(const EulerAngles &e)=default
Convention is set to C and angles are set to 0.
EulerAngles(const agx::Vec3 &angles, EulerConvention::Convention C=EulerConvention::DEFAULT_CONVENTION)
Explicit constructor.
EulerAngles(const Quat &q, EulerConvention::Convention C=EulerConvention::DEFAULT_CONVENTION)
Construct from quaternion in given convention.
EulerAngles(const OrthoMatrix3x3 &m, EulerConvention::Convention C=EulerConvention::DEFAULT_CONVENTION)
EulerAngles(const Matrix4x4T< T > &m, EulerConvention::Convention C=EulerConvention::DEFAULT_CONVENTION)
Construct from 4x4 matrix in given convention.
EulerAngles::EulerOrder & getOrder()
Get the convention.
EulerAngles(Real a, Real b, Real c, EulerConvention::Convention C=EulerConvention::DEFAULT_CONVENTION)
Explicit constructor.
bool get(Matrix3x3T< T > &m) const
Compute the value of matrix m that corresponds to current angles in current convention.
EulerAngles(const Matrix3x3T< T > &m, EulerConvention::Convention C=EulerConvention::DEFAULT_CONVENTION)
Construct from 3x3 Matrix in given convention.
static EulerAngles random(const Vec3 &min=Vec3(Real(0.0)), const Vec3 &max=Vec3(2 *agx::PI), EulerConvention::Convention c=EulerConvention::DEFAULT_CONVENTION)
Generate an EulerAngles object with random angles in every axis [ 0 - 2PI ].
EulerAngles & set(const Matrix3x3T< T > &m, EulerConvention::Convention C=EulerConvention::BAD)
Set the angles to correspond to matrix m in given convention.
Real z() const
Get the third angle.
Convention
The 24 Euler conventions.
@ DEFAULT_CONVENTION
The default Euler convention used by agx.
Matrix class for affine transformations.
Specialized types of matrices for holding orthogonal transformation matrices.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Vec3T< T > min(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Vec3T< T > max(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
std::ostream & operator<<(std::ostream &stream, const AtomicValueT< T > &value)