Quaternion Functions

Comprehensive collection of calculators for quaternion operations and 3D rotations

q = w + xi + yj + zk 3D Rotations Slerp Interpolation

Quaternions in 3D Mathematics

Quaternions are an extension of complex numbers and provide an elegant way to represent rotations in three-dimensional space. They avoid the gimbal lock problem and enable smooth interpolations between rotations.

Basic Operations

Addition
Add quaternions component-wise: (w₁+w₂) + (x₁+x₂)i + (y₁+y₂)j + (z₁+z₂)k
Subtraction
Subtract quaternions component-wise for difference calculations
Multiplication
Quaternion multiplication for rotation concatenation using Hamilton product
Division
Quaternion division by multiplication with the inverse
Scalar Multiplication
Multiplication of a quaternion with a scalar value
Dot Product
Calculate the dot product of two quaternions

Geometric Operations

Length (Magnitude)
Calculate the norm or magnitude of a quaternion: √(w²+x²+y²+z²)
Concatenate
Combine multiple rotations through quaternion multiplication

Transformations

Quaternion Transformations
Conjugate, inverse, normalization and negation
Inverse
Inverse and additional quaternion operations
Normalize
Create unit quaternion by dividing by magnitude
Negation
Conjugate, inverse, normalization and negation

Advanced Functions

Interpolation
Slerp (Spherical Linear Interpolation) for smooth rotation transitions
Yaw-Pitch-Roll
Conversion between quaternions and Euler angles (Yaw, Pitch, Roll)

Quaternion Fundamentals

Quaternion Properties
Representation:
q = w + xi + yj + zk
3D Rotation:
Unit quaternions for rotations
Interpolation:
Slerp for smooth transitions
Practical Applications
Computer Graphics
  • 3D rotations without gimbal lock
  • Camera control
  • Skeletal animation
  • Object transformations
Robotics & Simulation
  • Robot arms
  • Flight simulation
  • Inertial sensors
  • Orientation control

Important Quaternion Formulas

Hamilton Product

q₁ × q₂ = (w₁w₂ - x₁x₂ - y₁y₂ - z₁z₂) +
(w₁x₂ + x₁w₂ + y₁z₂ - z₁y₂)i +
(w₁y₂ - x₁z₂ + y₁w₂ + z₁x₂)j +
(w₁z₂ + x₁y₂ - y₁x₂ + z₁w₂)k

Norm (Magnitude)

|q| = √(w² + x² + y² + z²)

For unit quaternions: |q| = 1

Rotation around Axis

q = cos(θ/2) + sin(θ/2)(xᵢ + yⱼ + zₖ)

Where (x,y,z) is the rotation axis and θ is the angle