Quaternion Rotation Visualizer
Run the Quaternion Rotation Visualizer Fullscreen
Edit the Quaternion Rotation Visualizer with the p5.js editor
About This MicroSim
This MicroSim demonstrates quaternion rotation representation. Define a rotation axis and angle, see the quaternion components, apply rotations, and compose multiple rotations without gimbal lock.
How to Use
- Set Rotation Axis: Adjust X, Y, Z sliders to define the rotation axis
- Set Angle: Choose the rotation angle (0° to 360°)
- Apply Rotation: Set the object to this orientation
- Compose: Multiply this rotation with the current orientation
- Show Euler Angles: Toggle to see equivalent Euler angles
- Drag to Rotate: Change the view angle
Key Concepts
The quaternion formula for rotation by angle θ about unit axis n̂:
| Component | Symbol | Range |
|---|---|---|
| Scalar | w | -1 to 1 |
| Vector | (x, y, z) | unit sphere |
Learning Objectives
Students will be able to: - Convert between axis-angle and quaternion representations - Apply quaternion rotation formula q·p·q* - Compose rotations using quaternion multiplication - Compare quaternion and Euler angle representations
Lesson Plan
Introduction (5 minutes)
Quaternions extend complex numbers to 4D and provide a singularity-free rotation representation.
Exploration (15 minutes)
- Set axis to (0, 1, 0) and angle to 90° - observe the quaternion
- Apply the rotation and see the object orient
- Compose multiple rotations without gimbal lock
- Compare with equivalent Euler angles
Key Insight
Notice the half-angle in the quaternion: 90° rotation uses 45° in the formula because the q·p·q* operation effectively applies the rotation twice.