QTANG Name
QTANG
Author
Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
craigm@lheamail.gsfc.nasa.gov
UPDATED VERSIONs can be found on my WEB PAGE:
http://cow.physics.wisc.edu/~craigm/idl/idl.html
Purpose
Find rotation angle(s) of unit quaternion
Major Topics
Geometry
Calling Sequence
PHI = QTANG(Q)
Description
The function QTANG accepts a unit quaternion Q and returns the
rotation angle PHI of the quaternion.
Use QTAXIS and QTANG to extract the properties of an existing
quaternion. Use QTCOMPOSE to combine a rotation axis and angle
into a new quaternion.
Conventions for storing quaternions vary in the literature and from
library to library. This library uses the convention that the
first three components of each quaternion are the 3-vector axis of
rotation, and the 4th component is the rotation angle. Expressed
in formulae, a single quaternion is given by:
Q(0:2) = [VX, VY, VZ]*SIN(PHI/2)
Q(3) = COS(PHI/2)
where PHI is the rotation angle, and VAXIS = [VX, VY, VZ] is the
rotation eigen axis expressed as a unit vector. This library
accepts quaternions of both signs, but by preference returns
quaternions with a positive 4th component.
Inputs
Q - array of one or more unit quaternions. For a single
quaternion, Q should be a 4-vector. For N quaternions, Q
should be a 4xN array.
Returns
For a single quaternion, returns the scalar quaternion rotation
angle in radians. For N quaternions, returns an N-vector of
rotation angles. Keyword Parameters
NONE Example
IDL> print, qtang(qtcompose([0d,1,0], !dpi/4))
0.78539816
Prints the angle part of the quaternion composed of a rotation of
!dpi/4 radians around the axis [0,1,0]
See Also
QTANG, QTAXIS, QTCOMPOSE, QTERP, QTEXP, QTFIND, QTINV, QTLOG,
QTMAT, QTMULT, QTPOW, QTVROT
Modification History
Written, July 2001, CM
Documented, Dec 2001, CM
Usage message, error checking, 15 Mar 2002, CM