8#ifndef META_OCEAN_MATH_EULER_H
9#define META_OCEAN_MATH_EULER_H
20template <
typename T>
class HomogenousMatrixT4;
22template <
typename T>
class RotationT;
24template <
typename T>
class QuaternionT;
26template <
typename T>
class SquareMatrixT3;
29template <
typename T>
class EulerT;
107 explicit EulerT(
const T* arrayValue);
137 inline const T&
yaw()
const;
149 inline const T&
pitch()
const;
161 inline const T&
roll()
const;
194 inline const T&
operator[](
const unsigned int index)
const;
201 inline T&
operator[](
const unsigned int index);
208 inline const T&
operator()(
const unsigned int index)
const;
215 inline T&
operator()(
const unsigned int index);
282 ocean_assert(arrayValue);
283 memcpy(values_, arrayValue,
sizeof(T) * 3);
290 ocean_assert(isValid());
296 decomposeRotationMatrixToYXZ(
SquareMatrixT3<T>(rotation), values_[0], values_[1], values_[2]);
297 ocean_assert(isValid());
303 decomposeRotationMatrixToYXZ(
SquareMatrixT3<T>(quaternion), values_[0], values_[1], values_[2]);
304 ocean_assert(isValid());
310 decomposeRotationMatrixToYXZ(matrix, values_[0], values_[1], values_[2]);
311 ocean_assert(isValid());
367 return !(*
this == euler);
373 ocean_assert(index < 3u);
374 return values_[index];
380 ocean_assert(index < 3u);
381 return values_[index];
387 ocean_assert(index < 3u);
388 return values_[index];
394 ocean_assert(index < 3u);
395 return values_[index];
563 ocean_assert(
Euler(yaw, pitch, roll).isValid());
This class implements an euler rotation with angles: yaw, pitch and roll.
Definition Euler.h:80
EulerT()
Creates a new Euler rotation with all angles zero.
Definition Euler.h:264
static void decomposeRotationMatrixToXYZ(const SquareMatrixT3< T > &matrix, T &xAngle, T &yAngle, T &zAngle)
Decomposes a 3x3 rotation matrix to the corresponding x, y and z angles.
Definition Euler.h:480
const T & yaw() const
Returns the yaw angle.
Definition Euler.h:315
const T * operator()() const
Access operator.
Definition Euler.h:399
T values_[3]
The three angles of the euler rotation.
Definition Euler.h:260
const T & operator[](const unsigned int index) const
Element access operator.
Definition Euler.h:371
const T & roll() const
Returns the roll angle.
Definition Euler.h:339
bool operator!=(const EulerT< T > &euler) const
Returns whether two euler rotations are not identical up to a small epsilon.
Definition Euler.h:365
static void decomposeRotationMatrixToYXZ(const SquareMatrixT3< T > &matrix, T &yAngle, T &xAngle, T &zAngle)
Decomposes a 3x3 rotation matrix to the corresponding yaw, pitch and roll angles as defined by the eu...
Definition Euler.h:411
bool isValid() const
Returns whether the euler rotation holds valid parameters.
Definition Euler.h:351
T Type
Definition of the used data type.
Definition Euler.h:86
const T & pitch() const
Returns the pitch angle.
Definition Euler.h:327
static void adjustAngles(T &yaw, T &pitch, T &roll)
Adjusts euler angles with arbitrary value (e.g., outside the valid value range) to euler angles withi...
Definition Euler.h:549
bool operator==(const EulerT< T > &euler) const
Returns whether two euler rotations are identical up to a small epsilon.
Definition Euler.h:359
This class implements a 4x4 homogeneous transformation matrix using floating point values with the pr...
Definition HomogenousMatrix4.h:110
SquareMatrixT3< T > orthonormalRotationMatrix() const
Returns the 3x3 orthonormal rotation matrix of the 4x4 transformation (by forcing a orthogonal and no...
Definition HomogenousMatrix4.h:1538
This class provides basic numeric functionalities.
Definition Numeric.h:57
static constexpr bool isInsideRange(const T lower, const T value, const T upper, const T epsilon=NumericT< T >::eps())
Returns whether a value lies between a given range up to a provided epsilon border.
Definition Numeric.h:2872
static constexpr T pi_2()
Returns PI/2 which is equivalent to 90 degree.
Definition Numeric.h:938
static T atan2(const T y, const T x)
Returns the arctangent of a given value in radian.
Definition Numeric.h:1632
static constexpr T pi()
Returns PI which is equivalent to 180 degree.
Definition Numeric.h:926
static T angleAdjustNull(const T angle)
Adjusts an arbitrary angle into the range of (-PI, PI].
Definition Numeric.h:1794
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition Numeric.h:2386
static constexpr T copySign(const T signReceiver, const T signProvider)
Copies the sign of a given value to another one.
Definition Numeric.h:3264
static T asin(const T value)
Returns the arcsine of a given value.
Definition Numeric.h:2887
This class implements a unit quaternion rotation.
Definition Quaternion.h:100
This class implements a axis-angle rotation using floating point values.
Definition Rotation.h:79
This class implements a 3x3 square matrix.
Definition SquareMatrix3.h:88
bool isOrthonormal(const T epsilon=NumericT< T >::eps()) const
Returns whether this matrix is an orthonormal matrix.
Definition SquareMatrix3.h:1365
EulerT< float > EulerF
Instantiation of the EulerT template class using a single precision float data type.
Definition Euler.h:50
EulerT< Scalar > Euler
Definition of the Euler object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single o...
Definition Euler.h:36
std::vector< Euler > Eulers
Definition of a vector holding euler objects.
Definition Euler.h:65
EulerT< double > EulerD
Instantiation of the EulerT template class using a double precision float data type.
Definition Euler.h:43
std::vector< EulerT< T > > EulersT
Definition of a typename alias for vectors with EulerT objects.
Definition Euler.h:58
The namespace covering the entire Ocean framework.
Definition Accessor.h:15