Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


QTVROT

QTVROT

Name


  QTVROT

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


  Apply quaternion rotation to a 3-vector

Major Topics


  Geometry

Calling Sequence


  VNEW = QTVROT(V, Q, [/INVERT])

Description



  The function QTVROT applies a quaternion rotation (or its inverse)
  to a 3-vector V to produce a new vector VNEW.
  If both V and VNEW are vector components measured in the same
  inertial coordinate system, then VNEW returns the components of
  the vector V rotated by quaternion Q. I.e., the AXES stay fixed
  and the VECTOR rotates. Replace Q by QTINV(Q) in the case of
  /INVERT.
  If V are components of a vector measured in the "body" coordinate
  frame, and Q represents the orientation of the body frame
  w.r.t. the inertial frame, then VNEW are the components of the
  same vector in the inertial frame. I.e., the VECTOR stays fixed
  and the AXES rotate. For /INVERT, the coordinate transformation
  is from inertial frame to body frame.
  If either Q is a single quaternion, or V is a single 3-vector,
  then QTVROT will expand the single to the number of elements of
  the other operand. Otherwise, the number of quaternions and
  vectors must be equal.
  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



  V - array of one or more 3-vectors. For a single vector, V should
      be a 3-vector. For N vectors, V should be a 3xN array.
  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



  The resulting rotated vectors. For single inputs, returns a
  3-vector. For N inputs, returns N vectors as a 3xN array.

Keyword Parameters



  INVERT - if set, then the antirotation represented by QTINV(Q) is
            performed.

Example



  Q1 = qtcompose([0,0,1], 32d*!dpi/180d)
  Q2 = qtcompose([1,0,0], 116d*!dpi/180d)
  Q = qtmult(Q1, Q2)
  V = [[1d,0,0],[0,1,0],[0,0,1]]
  IDL> print, qtvrot(v, q)
        0.84804810 0.52991926 0.0000000
        0.23230132 -0.37175982 0.89879405
        0.47628828 -0.76222058 -0.43837115

See Also


  QTANG, QTAXIS, QTCOMPOSE, QTERP, QTEXP, QTFIND, QTINV, QTLOG,
  QTMAT, QTMULT, QTPOW, QTVROT

Modification History


  Written, July 2001, CM
  Documented, Dec 2001, CM
  Small changes, 28 Jan 2002, CM
  Usage message, error checking, 15 Mar 2002, CM
  $Id: qtvrot.pro,v 1.7 2002/05/09 23:03:27 craigm Exp $



© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us