8#ifndef META_OCEAN_MATH_EULER_H
9#define META_OCEAN_MATH_EULER_H
22template <
typename T>
class HomogenousMatrixT4;
24template <
typename T>
class QuaternionT;
26template <
typename T>
class RotationT;
28template <
typename T>
class SquareMatrixT3;
31template <
typename T>
class EulerT;
109 explicit EulerT(
const T* arrayValue);
139 inline const T&
yaw()
const;
151 inline const T&
pitch()
const;
163 inline const T&
roll()
const;
182 std::string
toString(
const bool inDegree =
false)
const;
203 inline const T&
operator[](
const unsigned int index)
const;
210 inline T&
operator[](
const unsigned int index);
217 inline const T&
operator()(
const unsigned int index)
const;
224 inline T&
operator()(
const unsigned int index);
291 ocean_assert(arrayValue);
292 memcpy(values_, arrayValue,
sizeof(T) * 3);
299 ocean_assert(isValid());
305 decomposeRotationMatrixToYXZ(
SquareMatrixT3<T>(rotation), values_[0], values_[1], values_[2]);
306 ocean_assert(isValid());
312 decomposeRotationMatrixToYXZ(
SquareMatrixT3<T>(quaternion), values_[0], values_[1], values_[2]);
313 ocean_assert(isValid());
319 decomposeRotationMatrixToYXZ(matrix, values_[0], values_[1], values_[2]);
320 ocean_assert(isValid());
393 return !(*
this == euler);
399 ocean_assert(index < 3u);
400 return values_[index];
406 ocean_assert(index < 3u);
407 return values_[index];
413 ocean_assert(index < 3u);
414 return values_[index];
420 ocean_assert(index < 3u);
421 return values_[index];
589 ocean_assert(
Euler(yaw, pitch, roll).isValid());
This class implements an euler rotation with angles: yaw, pitch and roll.
Definition Euler.h:82
EulerT()
Creates a new Euler rotation with all angles zero.
Definition Euler.h:273
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:506
const T & yaw() const
Returns the yaw angle.
Definition Euler.h:324
const T * operator()() const
Access operator.
Definition Euler.h:425
T values_[3]
The three angles of the euler rotation.
Definition Euler.h:269
const T & operator[](const unsigned int index) const
Element access operator.
Definition Euler.h:397
const T & roll() const
Returns the roll angle.
Definition Euler.h:348
bool operator!=(const EulerT< T > &euler) const
Returns whether two euler rotations are not identical up to a small epsilon.
Definition Euler.h:391
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:437
bool isValid() const
Returns whether the euler rotation holds valid parameters.
Definition Euler.h:360
std::string toString(const bool inDegree=false) const
Returns the euler rotation as string.
Definition Euler.h:368
T Type
Definition of the used data type.
Definition Euler.h:88
const T & pitch() const
Returns the pitch angle.
Definition Euler.h:336
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:575
bool operator==(const EulerT< T > &euler) const
Returns whether two euler rotations are identical up to a small epsilon.
Definition Euler.h:385
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:2881
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:1636
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:1800
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition Numeric.h:2395
static constexpr T copySign(const T signReceiver, const T signProvider)
Copies the sign of a given value to another one.
Definition Numeric.h:3273
static constexpr T rad2deg(const T rad)
Converts rad to deg.
Definition Numeric.h:3247
static T asin(const T value)
Returns the arcsine of a given value.
Definition Numeric.h:2896
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:73
This class implements a 3x3 square matrix.
Definition SquareMatrix3.h:89
bool isOrthonormal(const T epsilon=NumericT< T >::eps()) const
Returns whether this matrix is an orthonormal matrix.
Definition SquareMatrix3.h:1366
static std::string toAString(const char value)
Converts a value to a string with 8bit character.
std::vector< EulerT< T > > EulersT
Definition of a typename alias for vectors with EulerT objects.
Definition Euler.h:60
EulerT< Scalar > Euler
Definition of the Euler object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single o...
Definition Euler.h:38
std::vector< Euler > Eulers
Definition of a vector holding euler objects.
Definition Euler.h:67
The namespace covering the entire Ocean framework.
Definition Accessor.h:15