Euler angles
More actions
Euler angles are three angles that describe the orientation of a rigid body as a sequence of three rotations about chosen coordinate axes. They are named after the 18th-century Swiss mathematician Leonhard Euler.[1] The best-known set is yaw, pitch and roll, which describe the heading, nose-up angle and bank of an aircraft and are also used to describe the orientation of a user's head in virtual reality (VR).[2][3]
Any orientation can be reached with three such rotations.[3] In a 2006 Stanford University technical report, James Diebel calls Euler angles the most common way to represent the attitude of a rigid body, popular because they are easy to understand and easy to use, and game engines such as Unity display rotations to developers as Euler angles.[1][4] They have two well-documented weaknesses. Every Euler angle set has a singularity at certain values of its second angle, where the first and third rotations act about the same axis and one degree of freedom is lost; this is the condition usually called gimbal lock. They are also less accurate than unit quaternions when incremental changes in orientation are integrated over time.[1][5] LaValle recommends other representations for VR software for these reasons, and the cross-vendor OpenXR standard represents orientation as a unit quaternion, while engine editors such as Unity's still show Euler angles to the people who read and enter orientations.[3][4][6]
Definition
A rotation in three dimensions has three degrees of freedom, so three independent numbers are enough to describe it.[3] Euler angles build a general rotation from three rotations about coordinate axes, applied one after another. If the axes are numbered 1, 2 and 3 (x, y and z), the axis sequence can be written as a triple such as (3, 1, 3) or (1, 2, 3). Of the 27 possible triples, only the 12 in which no axis is repeated twice in a row can reach every orientation.[1] Ken Shoemake wrote in 1985 that "At least a dozen different conventions are possible for which series of axes to use."[2]
The 12 sets fall into two families. In the six symmetric sets the first and last axes are the same; in the six asymmetric sets all three axes differ.[5]
| Family | Axis sequences (1 = x, 2 = y, 3 = z) | Other names |
|---|---|---|
| Symmetric ("proper" Euler angles) | 1-2-1, 1-3-1, 2-1-2, 2-3-2, 3-1-3, 3-2-3 | The 3-1-3 set is the one most often called Euler angles; for gyroscopic motion such as a spinning top its angles are named spin, nutation and precession[1] |
| Asymmetric | 1-2-3, 1-3-2, 2-1-3, 2-3-1, 3-1-2, 3-2-1 | Cardan angles, Tait angles or Bryan angles; Diebel also gives Tait-Bryan angles and nautical angles for the 1-2-3 set[1][5] |
Diebel writes that the (1, 2, 3) angles are sometimes called Cardan angles, after the Italian Renaissance mathematician Gerolamo Cardano, or Tait-Bryan angles, after the Scottish mathematical physicist Peter Guthrie Tait, that they are commonly used in aerospace engineering and computer graphics, and that in aeronautics they are "commonly referred to simply as Euler angles" even though they are not the symmetric set, with the three angles called roll, pitch and yaw, or bank, attitude and heading.[1] Software documentation uses the name in the same loose way: Unity, for example, calls its rotations about the z, x and y axes Euler angles.[4]
Yaw, pitch and roll
In Shoemake's description, the orientation of an airplane is given as yaw (or heading) around a vertical axis, followed by pitch around a horizontal axis through the wings, followed by roll around the nose-to-tail line.[2] In the coordinate frame used in Steven M. LaValle's textbook Virtual Reality, where the y axis points up, yaw is a rotation of α about the y axis, pitch a rotation of β about the x axis and roll a rotation of γ about the z axis. The three combine as
R(α, β, γ) = Ry(α) Rx(β) Rz(γ)
with yaw and roll ranging over a full turn (0 to 2π) while pitch only needs the range -π/2 to π/2 to reach every orientation.[3]
The order matters because 3D rotations do not commute. LaValle gives the example that a yaw of π/2 followed by a pitch of π/2 does not give the same result as the pitch followed by the yaw, and writes that "Having the wrong matrix ordering is one of the most frustrating problems when writing software for VR."[3] Shoemake likewise stressed that the three angles "must be used in exactly the order given because rotations do not commute", and that the choice of order and axes is itself only a convention: some physicists use body axes z-x-z, while aeronautics uses z-y-x.[2] As a result, a triple of numbers such as (30, 45, 0) is meaningless unless the axis order, the sign convention and the handedness of the coordinate frame are also stated.[1]
History
According to the Rotations reference site maintained by mechanical engineers at the University of California, Berkeley and Rose-Hulman Institute of Technology, the Euler angle representation dates to work that Euler first presented in 1751, in a paper that was published only posthumously in 1862; in it he showed how three angles can parameterize a rotation.[5] LaValle dates Euler's rotation theorem to 1775: any rotation can be expressed as a single rotation by some angle about one axis through the origin.[3] Shoemake observed that Euler angles are handy for solving differential equations, which is how Euler used them.[2]
The Rotations site names early adopters including Joseph-Louis Lagrange, who used the angles in the late 1700s for the rotations of spinning tops and the Moon, and George H. Bryan, who used a set of Euler angles to describe the yaw, pitch and roll of an airplane in his 1911 book Stability in Aviation.[5] The site notes that Euler angles are widely used today in vehicle dynamics and orthopaedic biomechanics.[5]
In computer graphics, Shoemake's SIGGRAPH 1985 paper "Animating Rotation with Quaternion Curves" described the "common solution" for animating rotations between key frames, three Euler angles interpolated independently, as "not ideal", and proposed interpolation on the unit quaternion sphere instead, using a spherical interpolation the paper calls Slerp.[2]
Gimbal lock
The mathematical singularity
For every Euler angle set there are values of the second angle at which the representation breaks down.[5] For the yaw-pitch-roll (1, 2, 3) sequence the singularity is at a pitch of ±90 degrees: "the vehicle is pointing straight up, and roll and yaw are indistinguishable." For the symmetric (3, 1, 3) sequence it occurs when the middle angle is zero, and there is therefore a singularity at the home orientation itself. In the equations, the formulas that recover the first and third angles from a rotation matrix become undefined at these points.[1] LaValle shows the effect with yaw, pitch and roll: with the pitch held at π/2, the combined rotation matrix depends only on the difference α - γ, so two parameters vary but produce only one degree of freedom. He compares this with longitude at the North Pole, where longitude can change while the position on Earth does not.[3]
Diebel notes that the (1, 2, 3) parameterization is therefore suited only to vehicles that do not perform vertical or inverted maneuvers, such as land vehicles, ships and transport aircraft, and that a common remedy is to switch representations near a singularity or to use unit quaternions, which "completely avoids the problem of gimbal lock".[1] Shoemake described gimbal lock in animation as "the loss of one degree of rotational freedom", resulting from interpolation that ignores how rotations about different axes interact and so can align two of the three axes.[2]
Mechanical gimbals
The name comes from gimbaled hardware. The inertial measurement unit of the Apollo lunar module had outer, middle and inner gimbal rings carrying a stable platform, and the gimbal angles read from the rings were the Euler angles between that platform and the spacecraft's navigation base. If the middle gimbal reached 90 degrees, the inner gimbal axis lined up with the outer one and a dimension was lost. The lunar module's computer flashed a gimbal lock warning at 70 degrees and froze the platform at 85 degrees until it was realigned.[7] A 1963 MIT Instrumentation Laboratory memo by David Hoag explained that a fourth, redundant gimbal would avoid the problem, but Apollo kept the simpler three-gimbal design. About two hours after the Apollo 11 landing, CapCom Owen Garriott warned command module pilot Michael Collins that he was maneuvering very close to gimbal lock. Collins answered that he was going around it, and shortly afterwards joked: "How about sending me a fourth gimbal for Christmas."[7]
The Rotations site makes a distinction between the two uses of the term: in its usage gimbal lock is a physical phenomenon, in which forces and moments applied to a system of rigid bodies, typically a body suspended by gimbals, have no effect on some of its dynamics, while the Euler angle singularity is a mathematical one that is often wrongly called gimbal lock.[5] Hemingway and O'Reilly analyzed this relationship in detail in a 2018 paper in Multibody System Dynamics.[5]
Comparison with other rotation representations
| Representation | Numbers stored | Main advantages | Main drawbacks |
|---|---|---|---|
| Euler angles | 3 | Easy to understand and use; names such as roll, pitch and yaw are part of everyday language[1] | Singularities (gimbal lock); less accurate for integrating incremental changes in attitude[1] |
| Rotation matrix | 9 | Rotations combine by matrix multiplication[3] | Nine numbers constrained to three degrees of freedom[3] |
| Unit quaternion | 4 | No singularities; well suited to integrating angular velocity[1] | Parameters have no intuitive physical meaning; must keep unit norm[1] |
| Rotation vector | 3 | No Euler singularities and no quadratic constraint[1] | Less familiar; Diebel recommends it mainly for optimization problems[1] |
Converting between Euler angles and other forms involves trigonometric functions and arbitrary assumptions about the convention, and Shoemake noted that there is no reasonable way to "multiply" two Euler angle triples to combine rotations.[2] Interpolating each angle separately also makes the motion depend on how the coordinate axes were chosen: with quaternion interpolation "the motion is independent of coordinate axes", while "Euler interpolants, unfortunately, will do wildly different things" after the axes are rotated.[2]
Applications in VR and AR
Head tracking
Head orientation has three rotational degrees of freedom, and yaw, pitch and roll are one way to parameterize them; a headset with only rotational tracking (3DoF) tracks just these three (see Rotational tracking).[3] Euler angles are poorly suited to computing that orientation, however. In FPS games the player's view is usually not allowed to pitch all the way to straight up or straight down, which keeps the camera away from the singularity. In VR, LaValle points out, "it happens all the time that a user could pitch her head straight up or down", and the kinematic singularity "often causes the viewpoint to spin uncontrollably". He recommends axis-angle representations of rotation instead, and introduces quaternions as a closely related form that can be applied directly to rotate models.[3]
The Oculus Rift Development Kit is a documented example. In a 2014 ICRA paper, LaValle, Anna Yershova, Max Katsev and Michael Antonov of Oculus VR described head tracking that read a gyroscope, accelerometer and magnetometer, with sensor observations reported at 1000 Hz (the magnetometer readings change only at 220 Hz), and integrated the angular velocity directly as a unit quaternion, writing that "The quaternion representation allows singularity-free manipulation of rotations with few parameters" and that it is "crucial to making a numerically stable dead-reckoning method from gyro measurements".[8] The yaw and pitch vocabulary still describes the errors: the paper separates drift into tilt error, corrected with the accelerometer's measurement of gravity, and yaw error, rotation about the vertical axis, which gravity cannot reveal and which the Rift corrected with the magnetometer.[8]
Engines, runtimes and file formats
Developer tools commonly expose Euler angles for editing while storing quaternions or matrices internally. Unity stores rotations internally as quaternions but displays a Transform's rotation as Euler angles X, Y and Z, and warns that converting to Euler angles to do calculations risks gimbal lock.[4] Unity's scripting reference adds that values assigned to eulerAngles are converted to the quaternion format, so "the values you read back out may be quite different from the values you assigned", and that setting one axis at a time can "lead to drift and undesired rotations".[9] For animation, Unity offers Quaternion interpolation, which "rotates the GameObject across the shortest distance to a particular orientation", alongside Euler Angles interpolation and a variant that bakes Euler interpolation into a quaternion curve.[10]
The cross-vendor standards used by headsets do not use Euler angles for poses. The OpenXR XrPosef structure holds orientation as an XrQuaternionf that must be a unit quaternion, and a runtime must return XR_ERROR_POSE_INVALID if its norm deviates by more than 1% from unit length.[6] In the WebXR Device API, the orientation of an XRRigidTransform "is a quaternion describing the rotational component of the transform" and must be normalized to length 1.0.[11] OpenVR reports each tracked device pose as a 3x4 matrix (HmdMatrix34_t) in its TrackedDevicePose_t structure.[12]
| Software or format | How orientation is exposed | Euler convention, where one is used |
|---|---|---|
| Unity | Transform.eulerAngles in degrees; stored internally as a quaternion[4][9] | Rotations about the z axis, then the x axis, then the y axis; the Unity manual describes this as extrinsic rotation[4] |
| Unreal Engine | TRotator with Pitch, Yaw and Roll, all stored in degrees[13] | Intrinsic rotations in the order yaw (about the up, Z axis), pitch (about the right, Y axis), then roll (about the forward, X axis)[13] |
| Three.js | Euler class with x, y and z angles in radians and an axis order string[14] | Default order 'XYZ'; the source code handles six axis orders (XYZ, YXZ, ZXY, ZYX, YZX, XZY)[14][15] |
| OpenXR | XrPosef orientation as a unit quaternion[6] | None |
| WebXR | XRRigidTransform orientation as a unit quaternion[11] | None |
| OpenVR | 3x4 pose matrix[12] | None |
| Spherical Video V2 metadata | Projection pose as yaw, pitch and roll in degrees[16] | Yaw about the up vector, then pitch about the right vector, then roll about the forward vector[16] |
360-degree video metadata is one place where Euler angles remain the stored format. Google's Spherical Video V2 RFC, an open metadata scheme for spherical video in MP4 and WebM files, gives the projection's orientation in a projection header box as pose_yaw_degrees, pose_pitch_degrees and pose_roll_degrees. Yaw is a counter-clockwise rotation about the up vector restricted to -180 to 180 degrees, pitch a counter-clockwise rotation about the right vector after the yaw, restricted to -90 to 90 degrees, and roll a clockwise rotation about the forward vector after the yaw and pitch, restricted to -180 to 180 degrees.[16] Limiting pitch to plus or minus 90 degrees matches the range that LaValle gives for reaching every orientation with yaw, pitch and roll.[3]
See also
References
- ↑ 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 James Diebel (2006-10-20). "Representing Attitude: Euler Angles, Unit Quaternions, and Rotation Vectors". Stanford University (technical report). https://www.astro.rug.nl/software/kapteyn-beta/_downloads/attitude.pdf. Retrieved 2026-10-15.
- ↑ 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 Ken Shoemake (1985). "Animating Rotation with Quaternion Curves". SIGGRAPH '85, Computer Graphics vol. 19, no. 3. pp. 245-254. doi:10.1145/325334.325242. https://www.cs.cmu.edu/~kiranb/animation/p245-shoemake.pdf.
- ↑ 3.00 3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 Steven M. LaValle (2020). "Virtual Reality, Chapter 3: The Geometry of Virtual Worlds". Virtual Reality (online book), University of Oulu. http://lavalle.pl/vr/vrch3.pdf. Retrieved 2026-10-15.
- ↑ 4.0 4.1 4.2 4.3 4.4 4.5 "Quaternion and euler rotations in Unity". Unity Documentation. Unity Technologies. https://docs.unity3d.com/6000.4/Documentation/Manual/QuaternionAndEulerRotationsInUnity.html. Retrieved 2026-10-15.
- ↑ 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 Daniel T. Kawano, Alyssa Novelia, Oliver M. O'Reilly. "The Euler angle parameterization". Rotations (University of California, Berkeley and Rose-Hulman Institute of Technology). https://rotations.berkeley.edu/the-euler-angle-parameterization/. Retrieved 2026-10-15.
- ↑ 6.0 6.1 6.2 "XrPosef". OpenXR 1.1 Reference Pages. Khronos Group. https://registry.khronos.org/OpenXR/specs/1.1/man/html/XrPosef.html. Retrieved 2026-10-15.
- ↑ 7.0 7.1 Eric M. Jones, Paul Fjeld (2011-04-29). "Gimbal Angles, Gimbal Lock, and a Fourth Gimbal for Christmas". Apollo Lunar Surface Journal, NASA. https://web.archive.org/web/2019/https://www.hq.nasa.gov/alsj/gimbals.html. Retrieved 2026-10-15.
- ↑ 8.0 8.1 Steven M. LaValle, Anna Yershova, Max Katsev, Michael Antonov (2014). "Head Tracking for the Oculus Rift". IEEE International Conference on Robotics and Automation (ICRA). pp. 187-194. http://lavalle.pl/papers/LavYerKatAnt14.pdf.
- ↑ 9.0 9.1 "Transform.eulerAngles". Unity Scripting API. Unity Technologies. https://docs.unity3d.com/ScriptReference/Transform-eulerAngles.html. Retrieved 2026-10-15.
- ↑ "Rotation in animations". Unity Manual. Unity Technologies. https://docs.unity3d.com/Manual/AnimationRotate.html. Retrieved 2026-10-15.
- ↑ 11.0 11.1 "WebXR Device API". W3C Candidate Recommendation Draft. World Wide Web Consortium, Immersive Web Working Group. 2026-06-09. https://www.w3.org/TR/webxr/. Retrieved 2026-10-15.
- ↑ 12.0 12.1 "openvr.h". OpenVR SDK, GitHub. Valve Corporation. https://github.com/ValveSoftware/openvr/blob/master/headers/openvr.h. Retrieved 2026-10-15.
- ↑ 13.0 13.1 "TRotator". Unreal Engine C++ API Reference. Epic Games. https://dev.epicgames.com/documentation/unreal-engine/API/Runtime/Core/TRotator. Retrieved 2026-10-15.
- ↑ 14.0 14.1 "Euler". three.js docs. https://threejs.org/docs/pages/Euler.html. Retrieved 2026-10-15.
- ↑ "src/math/Euler.js". three.js, GitHub. https://github.com/mrdoob/three.js/blob/dev/src/math/Euler.js. Retrieved 2026-10-15.
- ↑ 16.0 16.1 16.2 "Spherical Video V2 RFC". Google spatial-media, GitHub. Google. https://github.com/google/spatial-media/blob/master/docs/spherical-video-v2-rfc.md. Retrieved 2026-10-15.