Intro
Quaternions are a mathematical representation used to describe orientations and rotations in three-dimensional space. Unlike Euler angles (roll, pitch, yaw), quaternions avoid issues such as gimbal lock and provide smoother interpolation of rotations.
A quaternion is composed of four components: , where:
- is the scalar part.
 - are the vector parts.
 
A unit vector represents the rotation axis, and a quaternion represents the rotation by an angle radians as follows:
Quaternion
Concept Representation Quaternion (4D) Rotation axis (x, y, z) and scalar (w) q = (x, y, z, w)Axis-Angle → Quaternion Given unit axis λ = (λₓ, λᵧ, λ_z) and angle θ: q = (λₓ·sin(θ⁄2), λᵧ·sin(θ⁄2), λ_z·sin(θ⁄2), cos(θ⁄2))
For example, a quaternion representing a 90-degree rotation around the Z-axis would be .
Euler Angles vs Quaternions
https://youtube.com/shorts/rh63Ykbw9Bw?feature=shared




