template <typename Scalar>
muu::euler_angles struct

A set of euler angles used for rotation.

Template parameters
Scalar The scalar component type of the data members.

This type models a specific form of Euler angles relating to the Aircraft Principal Axes, and observes the following conventions:

Yaw
  • Applied first
  • Corresponds to a rotation around the local up axis
  • A positive yaw means "turn the nose of the aircraft to the right"
Pitch
  • Applied second
  • Corresponds to a rotation around the local right axis
  • A positive pitch means "point the nose of the aircraft up toward the sky".
Roll
  • Applied third
  • Corresponds to a rotation around the local forward axis
  • A positive roll means "tilt the right wing of the aircraft toward the ground".

The angles are always in radians.

Public types

using scalar_type = Scalar
The scalar type of the rotation's angles.

Public static functions

static auto infinity_or_nan(const euler_angles& rot) -> bool constexpr noexcept
Returns true if any of the angles in a set of euler angles are infinity or NaN.

Constructors, destructors, conversion operators

euler_angles() defaulted noexcept
Default constructor. Values are not initialized.
euler_angles(const euler_angles&) defaulted constexpr noexcept
Copy constructor.
euler_angles(scalar_type yaw, scalar_type pitch, scalar_type roll = scalar_type{}) constexpr noexcept
Initializes from three separate euler angles.
euler_angles(const vector<scalar_type, 3>& v) explicit constexpr noexcept
Initializes from a vec3, where x, y and z are yaw, pitch and roll, respectively.
template <typename T>
euler_angles(const euler_angles<T>& other) explicit constexpr noexcept
Converting constructor.
template <typename T>
euler_angles(const T& obj) constexpr noexcept
Constructs a set of euler angles from an implicitly bit-castable type.
operator vector<scalar_type, 3>() const explicit constexpr noexcept
Converts the euler angles to a vec3, where x, y and z are yaw, pitch and roll, respectively.

Public functions

auto infinity_or_nan() const -> bool constexpr noexcept
Returns true if any of the angles are infinity or NaN.
auto operator*=(scalar_type rhs) -> euler_angles& constexpr noexcept
Scales the euler angles.
auto operator=(const euler_angles&) -> euler_angles& defaulted constexpr noexcept
Copy-assigment operator.

Public variables

scalar_type yaw
The rotation around the local up axis (in radians).
scalar_type pitch
The rotation around the local right axis (in radians).
scalar_type roll
The rotation around the local forward axis (in radians).

Friends

auto operator*(const euler_angles& lhs, scalar_type rhs) -> euler_angles constexpr noexcept
Scales a set of euler angles.
auto operator*(scalar_type lhs, const euler_angles& rhs) -> euler_angles constexpr noexcept
Scales a set of euler angles.
template <typename Char, typename Traits>
auto operator<<(std::basic_ostream<Char, Traits>& os, const euler_angles& rot) -> std::basic_ostream<Char, Traits>&
Writes a set of euler angles out to a text stream.

Function documentation

template <typename Scalar>
template <typename T>
muu::euler_angles::euler_angles(const T& obj) constexpr noexcept

Constructs a set of euler angles from an implicitly bit-castable type.

Template parameters
T A bit-castable type.

Variable documentation

template <typename Scalar>
scalar_type muu::euler_angles::yaw

The rotation around the local up axis (in radians).

template <typename Scalar>
scalar_type muu::euler_angles::pitch

The rotation around the local right axis (in radians).

template <typename Scalar>
scalar_type muu::euler_angles::roll

The rotation around the local forward axis (in radians).