Quaternion Explorer

Interactive 3D Rotation Visualization for Geometric Constraint Theory

Current Rotation

q = 1.00 + 0.00 i + 0.00 j + 0.00 k
|q| = 1.000

Rotation Matrix

Rotation Controls

Quaternion Operations

q₁ =
×
q₂ =
=
result

Preset Rotations

Euler vs Quaternion Comparison

Gimbal Lock Warning: Euler angles can lose a degree of freedom when two axes become aligned. Quaternions avoid this problem.

Normal
Always Valid

SLERP Interpolation

Interpolates between two rotations along the shortest path

Start: identity
End: 90° X

Rotation Path

Path points: 0

Quaternion Theory

Definition

A quaternion is an extension of complex numbers to 4D:

q = w + xi + yj + zk

where i² = j² = k² = ijk = -1

Rotation Quaternion

For rotation by angle θ around axis (x, y, z):

q = cos(θ/2) + sin(θ/2)(xi + yj + zk)

Advantages over Euler Angles

  • No gimbal lock
  • Smooth interpolation (SLERP)
  • Efficient composition
  • Numerical stability

Operations

  • Multiplication: Combines rotations
  • Conjugate: q* = w - xi - yj - zk (inverse rotation)
  • Inverse: q⁻¹ = q*/|q|² (for unit quaternions, q⁻¹ = q*)
  • SLERP: Smooth interpolation between rotations