Rick Jacoby, 4/97
Advanced Displays and Spatial Perception Laboratory
Human and Systems Technologies Branch
NASA Ames Research Center
Moffett Field, CA 94035-1000
A quaternion, a rotation matrix and a set of Euler angles all specify a rotation operation; i.e.: an operation that rotates an object from one (base) orientation to another (final) orientation. Therefore a quaternion does not specify an orientation in space, only the change in orientation from a previous orientation.
A quaternion has 4 components, (qw, qx, qy, qz). Visualizing a quaternion rotation can by done as follows:
As an example, consider the quaternion q = (0.8, 0.0, 0.6, 0.0). Looking at the (qx, qy, qz) we see a point on the Y-axis at 0.6 units from the origin. The rotation axis points away from the origin along the Y-axis. The arc_cos(0.8) is approximately 37 degrees, the rotation is 74 degrees about the positive Y-axis.
Some software use quaternions that are ordered W-X-Y-Z (W-first) and other software expects the order to be X-Y-Z-W (W-last).
WTK expects quaternions in the W-last order (and inverted).
The VIEW library quaternion functions, quatprint(), quatmul(), quatinv(), etc. expect W-first order.
The Polhemus reports W-first.
The values in shared memory, and the values reported by SMMON are also W-first.
Shrmem_retrievedata() reads the shared memory values, but returns to the user, quaternions of the form W-last.
Note: Stefan recorded data using shrmem_retrievedata() so his data files are also W-last order.
The NAS tetra-interpolation functions (used by SPI and AST) use the library quaternion functions (W-first) so Stefan's data must be converted when read in by SPI.