Quaternions· Visually
Free tutorial · 10 interactive lessons, 30 visuals and a C library

Quaternions, finally clear.

Four numbers that describe any 3D orientation, with no gimbal lock. Here you don't just read the formulas: you turn the object, move the sliders and watch every number change.

No sign-up · works in the browser · C code included

An object turning from one random orientation to the next. Each move is one turn about one axis, and q changes smoothly. Drag to look around.
What you'll learn

Three parts, from "why" to working C code

A

Why quaternions, and what they are

We see where Euler angles break, look at rotations as one turn about one axis, and meet the four numbers.

  1. 1Why quaternions? Gimbal lock, seen live
  2. 2Any orientation is one turn about one axis
  3. 3Warm-up: multiplying complex numbers is rotating in 2D
  4. 4Meet the quaternion: four numbers for one turn
B

Working with quaternions

Multiply them, rotate vectors with them, chain rotations, and convert to matrices and Euler angles.

  1. 5Multiplying quaternions: two turns become one
  2. 6Rotating a vector: the q v q* sandwich
  3. 7Chaining turns: the object's axes or the world's axes
  4. 8From quaternion to rotation matrix and Euler angles, and back
C

Quaternions in practice

Update an orientation from its turn rate, blend two orientations smoothly, and write it all in C.

  1. 9A spinning object: updating q from the turn rate
  2. 10Blending two orientations: slerp
  3. 11A small quaternion library in C
How a lesson works

Read a little, play with it, check yourself

  • 1 · Read

    One idea at a time

    Short text in plain words, and only the formulas we really use in code.

  • 2 · Play

    Visuals, one idea at a time

    Each lesson has several small visuals, one idea each, from the simplest case to the full picture. Turn the object, move the sliders, and see the four numbers react.

  • 3 · Check

    A few quick questions

    Open the answer when you are ready. If it feels easy, you've got it.

Is it for you

For anyone who needs 3D rotations to make sense

Good fit

You make games, 3D graphics, animation, robots, drones or VR, or you study them. You have seen quaternion formulas and want to finally understand them, or you are meeting them for the first time.

What you need

School trigonometry and a browser. No library to install and no account.

Sources

Built on standard references

The formulas and conventions follow these texts. Each lesson lists the ones it uses, with the section to read if you want the full derivation.

FAQ

Questions

How much math do I need?

School trigonometry: sin, cos and a right triangle. Vectors help, and lesson 3 shows the only bit of complex numbers we need. Everything else we build on the way, with pictures first.

Where are quaternions used?

Wherever something turns in 3D: game engines and animation, 3D graphics and cameras, robots and drones, spacecraft, phones and VR headsets.

Is it really free?

Yes. All 11 lessons are free to read, with no sign-up.

Which convention do you use?

Hamilton quaternions with w first, q = [w, x, y, z], and right-handed axes with x forward, y left and z up. Euler angles are in ZYX order (yaw, pitch, roll). Lesson 11 notes what to check if your engine or library does it differently.

Can I use the C code in my project?

Yes. Copy the two files into any C or C++ project. Lesson 11 shows how to test it first.

Does it work on my phone?

Yes. Drag with one finger to turn the 3D views. A bigger screen is nicer for the labs with two views side by side.