Rotation Matrix Calculator

Online calculator to convert Euler angles to a rotation matrix

Calculate ZYX rotation matrix


This function calculates the 3D rotation of a body/vector with Euler angles according to the ZYX convention.

The unit of measurement of the angles can be switched between degrees and radians.

Active rotation (rotate object) or passive rotation (rotate coordinates) can be calculated.

Enter the rotation angles for the calculation. Then click on the 'Calculate' button.


Calculator XYZ axis rotation

 Input
Angle α, Z (Yaw)
Angle β, Y (Pitch)
Angle γ, X (Roll)
Unit of angles
Rotation mode
Decimal places
Result
M11   M12   M13
  M21   M22   M23
  M31   M32   M33

Matrix rotation around the Z,Y and X axes

A problem with the rotation with 3 angles is then, when a configuration is created in which 2 axes of rotation are superimposed.

With the ZYX convention, a problem arises when setting a pitch angle of 90∘. Then both roll and yaw are the same movement, but this does not cause any change in attitude. This condition, called "gimbal lock" and must be prevented. For this reason rotation with the quaternion is often preferred.

Rotation with the quaternion can be found here


Active rotation

With the active rotation, the vector or the object is rotated in the coordinate system. The active rotation is also called geometric transformation. The rotation is counterclockwise.

Example of a 90° rotation of the z-axis counterclockwise.
\(R_z(\alpha)= \left[\matrix{1 & 0 & 0\\ 0 & \cos \alpha & -\sin \alpha \\0 & \sin \alpha & \cos \alpha } \right]\) \(= \left[\matrix{1 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0} \right]\)

Passive Rotation

With passive rotation, the coordinate system is rotated. The vector remains unchanged. The rotation is clockwise.


Example of a 90° rotation of the z-axis clockwise.
\(R_z^{-1}(\alpha)= \left[\matrix{1 & 0 & 0 \\ 0 & \cos \alpha & \sin \alpha \\0 & -\sin \alpha & \cos \alpha } \right]\) \(= \left[\matrix{1 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & -1 & 0 } \right]\)

Yaw, Pitch, Roll Rotation

A 3D object can be rotated around three axes. These rotations are known as yaw pitch rolls.

Yaw

Yaw denotes counterclockwise rotation of the Z axis. The rotation matrix has the following dimensions.

\(R_z(\alpha;)= \left[\matrix{ 1 & 0 & 0 \\ 0 & \cos \gamma; & - \sin \gamma; \\ 0 & \sin \gamma; & \cos \gamma; } \right]\)

Pitch

Pitch refers to the counter-clockwise rotation of the Y-axis. The rotation matrix for this is shown in the next figure.

\(R_y(\beta)= \left[\matrix{\cos \beta & 0 & \sin \beta \\ 0 & 1 & 0 \\ - \sin \beta & 0 & \cos \beta} \right]\)

Roll

Roll is the counter-clockwise rotation of the X-axis. The X-axis rotation matrix is shown in the next figure.

\(R_x(\gamma)= \left[\matrix{\cos \alpha & - \sin \alpha & 0 \\ \sin \alpha & \cos \alpha & 0 \\0 & 0 & 1} \right]\)

Formula for yaw, pitch, roll rotation

Each rotation matrix is a simple extension of the 2D rotation matrix.

The yaw, pitch and roll rotations can be used to place a 3D body in any direction.
A single rotation matrix can be formed by multiplying the matrices.

\(R(\alpha\beta\gamma) = R_z(\alpha)\cdot R_y(\beta)\cdot R_x(\gamma)= \)

\( \left[ \matrix{ cos\; \alpha \cdot cos\; \beta & cos\; \alpha \cdot sin \;\beta \cdot sin\; \gamma - sin\; \alpha \cdot cos\; \gamma & cos\; \alpha \cdot sin\; \beta \cdot cos\; \gamma + sin\; \alpha \cdot sin\; \gamma \\ sin\; \alpha \cdot cos\; \beta & sin\; \alpha \cdot sin \;\beta \cdot sin\; \gamma + cos\; \alpha \cdot cos\; \gamma & sin\; \alpha \cdot sin\; \beta \cdot cos\; \gamma - cos\; \alpha \cdot sin\; \gamma \\ -sin\;\beta & cos\;\beta \cdot sin \;\gamma & cos\;\beta \cdot cos\;\gamma } \right]\)

Is this page helpful?            
Thank you for your feedback!

Sorry about that

How can we improve it?