Converts a quaternion (w, x, y, z) representation to Euler angles (roll, pitch, yaw) using the specified rotation order.
Arguments
- w
Numeric. Scalar (real) part of the quaternion.
- x
Numeric. First imaginary component.
- y
Numeric. Second imaginary component.
- z
Numeric. Third imaginary component.
- order
Character. Rotation order. Default
"ZYX".- degrees
Logical. If
TRUE(default), return Euler angles in degrees. IfFALSE, return in radians.
Value
A matrix with columns roll, pitch, yaw. If inputs
are scalars, returns a 1-row matrix. If inputs are vectors,
returns a matrix with one row per element.
Details
For the "ZYX" (Tait-Bryan) convention:
roll = rotation about X axis
pitch = rotation about Y axis
yaw = rotation about Z axis
The quaternion is assumed to be unit (normalized). If not unit, it is normalized internally before conversion.