Definition: A quaternion is a number with four components (x, y, z, w) that 3D engines and tracking systems use to store and calculate rotations in space. Unlike the familiar angles for yaw, pitch and roll, quaternions have no gimbal lock, and you can blend them smoothly between two orientations. The mathematician William Rowan Hamilton described them in 1843.
English: Quaternion
German: Quaternion
How It Works
You can describe each rotation in space as a rotation around one single axis by a specific angle. A quaternion stores exactly this: the components x, y and z give the direction of the rotation axis, and w depends on the rotation angle. For rotations, you use unit quaternions with a length of 1.
The problem with yaw, pitch and roll: Three single rotations done one after the other (Euler angles) are easy to understand, but they have a weakness. In some positions, for example when the object is tilted upward by 90 degrees, two rotation axes align. One direction of rotation is lost, and the movement jumps or locks. This is called gimbal lock, after the gimbal suspension, in which the same effect occurs mechanically.
Why engines use quaternions:
- No gimbal lock in any position,
- Smooth transitions between two orientations (interpolation, "slerp"),
- Compact (four numbers instead of the nine of a rotation matrix) and numerically stable.
The user interface usually still shows degree values for yaw, pitch and roll; the conversion happens internally. Standards also use quaternions: glTF 2.0 stores the rotation of nodes as a quaternion, and the WebXR Device API gives the orientation of the headset and the controllers as a quaternion.
Importance in Mechanical Engineering
- Motion tracking in AR and VR: Headsets, tablets and VR controllers report their orientation as a quaternion. Only this way does a displayed machine stay stable in its position, also during fast head movements.
- Interactive 3D viewers: When you rotate a model freely in the web viewer or at the kiosk, quaternions work in the background, so that the model behaves the same in every position.
- Animated sequences: Swivel arms, robot axes or exploded views move smoothly from one position to the next with quaternion interpolation.
Frequently Asked Questions (FAQ)
Do you have to understand quaternions to create 3D content?
No. Design engineers and content creators work with degree values. The topic becomes important only for programming, or when rotations jump unexpectedly during data exchange.
Why does the same quaternion value look different in two programs?
Programs differ in the order of the components (x, y, z, w or w, x, y, z) and in the coordinate axes (Y up or Z up). For data exchange, both conventions must match.
Related Topics
- Motion tracking – capture of movement and orientation
- VR controllers – tracked input devices
- Sensors – gyroscope and accelerometer
- SLAM – localization in space
- Real-time rendering – rendering in real time
- Virtual reality – immersive 3D environments
