>  Docs Center  >  Libraries  >  Markwardt  >  QTCOMPOSE
Libraries

QTCOMPOSE

QTCOMPOSE

Name


  QTCOMPOSE

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


  Convert a rotation angle and axis into quaternion

Major Topics


  Geometry

Calling Sequence


  Q = QTCOMPOSE(VAXIS, PHI)

Description



  The function QTCOMPOSE accepts a unit vector rotation axis VAXIS
  and a rotation angle PHI, and returns the corresponding quaternion.
  The user must take care to pass the same number of axes as rotation
  angles.
  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



  VAXIS - array of one or more unit vectors specifying the rotation
          axes. For a single rotation, VAXIS should be a 3-vector.
          For N vectors, VAXIS should be a 3xN array.
  PHI - one or more rotation angles, in radians. For a single
        rotation, PHI should be a scalar. For N rotations, PHI
        should be an N-vector.

Returns



  For a single rotation, returns a quaternion as a 4-vector. For N
  rotations, returns a 4xN vector of quaternions.

Keyword Parameters



  NONE

Example



  IDL> print, qtcompose([0d,1,0], !dpi/4)
          0.0000000 0.38268343 0.0000000 0.92387953
  Prints 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
  Allow output to be DOUBLE, 27 Jan 2002, CM
  Allow vector vs scalar arguments, 28 Jan 2002, CM
  Usage message, error checking, 15 Mar 2002, CM



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us