QTMULTN Name
QTMULTN
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
Multiply several quaternions
Major Topics
Geometry
Calling Sequence
QRESULT = QTMULTN(Q1, Q2, ..., [/INV1, /INV2, ...] )
Description
The function QTMULTN performs multiplication of quaternions.
It is a convenience routine to simplify the multiplication
of a chain of several quaternions.
For example,
QTMULTN(Q1,Q2,Q3,/INV3,Q4)
is the same as,
QTMULT(Q1,QTMULT(Q2,QTMULT(QTINV(Q3),Q4)))
Up to eight quaternions may be multiplied with this routine.
As for QTMULT(), Qn may be 'vectors' of quaternions, if the Qn are
4xN arrays. In that case the input arrays must be of the same
dimension.
Note that quaternion multiplication is not commutative.
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
Qn - array of one or more unit quaternions, the nth operand in the
multiplication. For a single quaternion, Qn should be a
4-vector. For N quaternions, Qn should be a 4xN array.
If INVn is set, then the inverse of Qn is used.
INVn - if set, use QTINV(Qn) in place of Qn.
Returns
The resulting multiplied unit quaternions. For a single inputs,
returns a 4-vector. For N input quaternions, returns N
quaternions as a 4xN array.
Keyword Parameters
NONE
Example
Q1 = qtcompose([0,0,1], 32d*!dpi/180d)
Q2 = qtcompose([1,0,0], 116d*!dpi/180d)
IDL> print, qtmult(q1, q2)
0.81519615 0.23375373 0.14606554 0.50939109
Form a rotation quaternion of 32 degrees around the Z axis, and
116 degrees around the X axis, then multiply the two quaternions.
See Also
QTANG, QTAXIS, QTCOMPOSE, QTERP, QTEXP, QTFIND, QTINV, QTLOG,
QTMAT, QTMULT, QTMULTN, QTPOW, QTVROT
Modification History
Written, 30 Aug 2007, CM