This project visualizes quaternionic storage of 3D rotation in MATLAB through an interactive plot with a manual slider.
- Left panel: Quaternion path on S³ (projected to 3D) with trace and ±q mirrored path.
- Right panel: 3D rotated vector corresponding to the quaternion.
- Demonstrates:
- Half-angle storage (
θ/2
inside the quaternion). - SU(2) double-cover property (±q represent the same rotation).
- Continuous rotation without gimbal lock.
- Half-angle storage (
- Open
QuaternionVisualization.m
in MATLAB. - Run the script.
- Adjust the slider at the bottom to set the rotation angle θ.
- Observe:
- Left: quaternion moves along S³ projection.
- Right: rotated vector (red) vs original (blue).
- No autoplay — this version is fully manual for user control.
A rotation quaternion is defined as:
s = cos(theta/2)
v = [ ux*sin(theta/2), uy*sin(theta/2), uz*sin(theta/2) ]
q = [ s, v[0], v[1], v[2] ]
- θ — rotation angle in 3D space
- u — unit vector rotation axis
- Half-angle — stored as θ/2 in quaternion space.
Applying the rotation to vector v:
v' = q, v, q^{-1}
Feature | Description |
---|---|
S³ Projection | Quaternion trajectory shown in 3D projection |
±q Mirroring | Faint mirrored path showing double cover |
Trace Line | Visual trace of quaternion path |
3D Rotation | Red rotated vector vs blue reference |
Slider | Manual control of rotation angle |
QuaternionVisualization.m
— main MATLAB scriptdiagram.png
— schematic showing S³ projection and vector rotationREADME.md
— documentation (this file)
- MATLAB R2020a or later
- No additional toolboxes required
Developed for quaternionic visualization and SU(2) storage exploration in MATLAB.