Skip to content
Rotation Converter3D ORIENTATION / TECHNICAL REFERENCE
ROTATION CONVERTER / IMPLEMENTATION GUIDE

Rotation matrices, Euler angles, quaternions & axis-angle

A 3D orientation has three rotational degrees of freedom, but there is more than one way to encode it. This guide explains the four representations accepted by Rotation Converter and how to read the values shown by its current implementation.

Rotation matrices: nine entries, three degrees of freedom

A direction cosine matrix (DCM) is a 3 × 3 matrix. For a proper rotation its rows and columns are orthonormal: C Cᵀ = Cᵀ C = I, and det(C) = +1. The nine entries are therefore constrained; an arbitrary collection of nine numbers is not necessarily an orientation.

Enter matrices in row-major order: the first three numbers form row 1, the next three row 2, and the last three row 3. The identity matrix leaves the components of a vector unchanged. In the passive convention used by the tool, +90° about Z gives the matrix below. Multiplying it by the column vector [1, 0, 0]ᵀ produces [0, −1, 0]ᵀ. This is a change of vector coordinates, not a claim that the physical vector moved.

The input parser extracts numbers rather than executing MATLAB, Python, or C++ code. A DCM requires exactly nine numbers. Paste one matrix at a time; extra numeric text in comments, variable names, or type names can be interpreted as input. A bare numeric array is the safest interchange format.

C_Z(90°) = [ 0  1  0
             −1  0  0
              0  0  1 ]

Euler angles: sequence first, values second

This app implements six distinct-axis (Tait–Bryan) sequences: XYZ, XZY, YXZ, YZX, ZXY, and ZYX. The corresponding numeric labels are 123, 132, 213, 231, 312, and 321. Repeated-axis sequences such as ZXZ are not implemented. The older claim of twelve supported sequences was inaccurate.

Interactive input labels each field by its axis. Internally X is stored as roll, Y as pitch, and Z as yaw. Changing the sequence reorders the fields but does not rename the underlying axes. Bulk input instead expects values in the selected sequence order: for ZYX, [10, 20, 30] means Z = 10°, Y = 20°, X = 30°.

Passive output also follows the selected sequence order, not a fixed roll–pitch–yaw list. With 321 (ZYX) selected, the output [10, 20, 30] means [yaw, pitch, roll]. In Active mode the output section reverses the extraction sequence internally, then reverses the first and last displayed values. Use the conventions guide before transferring Active-mode values to another package.

Euler angles are convenient for controls and readable reports, but not unique. Adding a full turn to an angle leaves the orientation unchanged. Other equivalent branches also exist, and near a singularity large changes in individual angles may describe very small orientation changes.

Quaternions: a unit four-vector with a double cover

The input order is [x, y, z, w], with the scalar component w last. For a unit axis u and rotation angle θ, the quaternion is [uₓ sin(θ/2), uᵧ sin(θ/2), u_z sin(θ/2), cos(θ/2)]. For +90° about Z this is approximately [0, 0, 0.707107, 0.707107]. The app uses this quaternion to construct a passive DCM with its own sign convention.

The interactive and bulk quaternion-to-matrix paths do not automatically normalize input. Normalize a nonzero quaternion yourself: divide every component by √(x² + y² + z² + w²). An all-zero quaternion is not a valid rotation quaternion, even though the current matrix formula happens to return an identity matrix for it.

The matrix-to-quaternion routine selects the largest squared component to improve numerical stability and normalizes the extracted quaternion. This does not validate or repair a bad input matrix. Both q and −q produce the same matrix: every relevant product of two quaternion components is unchanged when both signs reverse. Do not compare orientations by requiring identical quaternion signs.

Axis-angle: a direction and an amount

Axis-angle input contains [axis x, axis y, axis z, angle]. The tool normalizes the axis before constructing the DCM, so [0, 0, 2, 90] and [0, 0, 1, 90] describe the same passive rotation when degrees are selected. The axis must have nonzero length. A zero axis causes non-finite values in the current formula; it is not a valid way to request an identity rotation.

For zero angle the axis is arbitrary: every nonzero axis gives identity. For a nonzero angle, reversing the axis and reversing the angle describes the same orientation. Output uses the extracted quaternion to compute axis-angle with 2 atan2(‖q_vector‖, w). A negative scalar component can therefore yield an angle above 180°; this is a valid equivalent description, not necessarily the smallest-angle representation.

The visible axis-angle output is quaternion-derived. The internal DCM-to-axis-angle helper uses a different antisymmetric sign convention and is not what the output formatter displays. These guides and examples refer to the visible output, not that helper.