Rotating a Cube Using Quaternions
Rotating a Cube Using Quaternions
A quaternion can represent both a rotation axis and the angle of rotation about this axis (a vector and a scalar). Instead of turning an object through a series of successive rotations with rotation matrices, quaternions are used to rotate an object more smoothly around an arbitrary axis (here ) and at any angle. This program uses the quaternion rotation formula: '=q with =0, (a pure quaternion), , and for a unit quaternion =, such that if , =(a,-b,-c,-d). A derivation of these formulas is given in[1].
u
1
p
1
p
1
-1
q
p
1
u
1
q=cos(α/2),sin(α/2)
u
1
-1
q
-
q
q=(a,b,c,d)
-
q
References
References
[1] Wikipedia. "Quaternions and Spatial Rotation." (Feb 9, 2016) en.wikipedia.org/wiki/Quaternions_and_spatial _rotation.
External Links
External Links
Permanent Citation
Permanent Citation
Gerard Balmens
"Rotating a Cube Using Quaternions"
http://demonstrations.wolfram.com/RotatingACubeUsingQuaternions/
Wolfram Demonstrations Project
Published: February 15, 2016