Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_axisar

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_AXISAR constructs a rotation matrix that rotates vectors by a
   specified angle about a specified axis.

I/O


   Given:

      axis,
      angle    an arbitrary, non-zero, double precision 3-vector rotation axis
               and a double precision angle.

               help, axis
                  DOUBLE = Array[3]
               help, angle
                  DOUBLE = Scalar

               `axis' and `angle' determine a coordinate transformation whose
               effect on any vector V is to rotate V by `angle' radians about
               the vector `axis'.

   the call:

      cspice_axisar, axis, angle, r

   returns:

      r        a rotation matrix representing the coordinate transformation
               determined by `axis' and `angle': for each vector `v', r*v is
               the vector resulting from rotating `v' by `angle' radians about
               `axis'.

               help, r
                  DOUBLE = Array[3,3]

Parameters


   None.

Examples


   Any numerical results shown for these examples may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Compute a matrix that rotates vectors by pi/2 radians about
      the Z-axis, and compute the rotation axis and angle based on
      that matrix.


      Example code begins here.


      PRO axisar_ex1

         ;;
         ;; Define an axis and an angle for rotation.
         ;;
         axis  = [ 0.D0, 0.D0, 1.D0 ]
         angle = cspice_halfpi()

         ;;
         ;; Determine the rotation matrix.
         ;;
         cspice_axisar, axis, angle, rotmat

         ;;
         ;; Now calculate the rotation axis and angle based on
         ;; `rotmat' as input.
         ;;
         cspice_raxisa, rotmat, axout, angout

         ;;
         ;; Display the results.
         ;;
         print, format='(A)', 'Rotation matrix:'
         print
         print, format='(3F10.5)', rotmat
         print
         print, format='(A,3F10.5)', 'Rotation axis       :', axout
         print, format='(A,F10.5)', 'Rotation angle (deg):',                 $
                                    angout * cspice_dpr()

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Rotation matrix:

         0.00000  -1.00000   0.00000
         1.00000   0.00000   0.00000
         0.00000   0.00000   1.00000

      Rotation axis       :   0.00000   0.00000   1.00000
      Rotation angle (deg):  90.00000


   2) Linear interpolation between two rotation matrices.

      Let r(t) be a time-varying rotation matrix; `r' could be
      a C-matrix describing the orientation of a spacecraft
      structure. Given two points in time `t1' and `t2' at which
      r(t) is known, and given a third time `t3', where

         t1  <  t3  <  t2,

      we can estimate r(t3) by linear interpolation. In other
      words, we approximate the motion of `r' by pretending that
      `r' rotates about a fixed axis at a uniform angular rate
      during the time interval [t1, t2]. More specifically, we
      assume that each column vector of `r' rotates in this
      fashion. This procedure will not work if `r' rotates through
      an angle of pi radians or more during the time interval
      [t1, t2]; an aliasing effect would occur in that case.


      Example code begins here.


      PRO axisar_ex2

         ;;
         ;; Lets assume that r(t) is the matrix that rotates
         ;; vectors by pi/2 radians about the Z-axis every
         ;; minute.
         ;;
         ;; Let
         ;;
         ;;    r1 = r(t1), for t1 =  0", and
         ;;    r2 = r(t2), for t1 = 60".
         ;;
         ;; Define both matrices and times.
         ;;
         axis = [ 0.D0, 0.D0, 1.D0 ]

         t1   =  0.D0
         t2   = 60.D0
         t3   = 30.D0

         cspice_ident, r1
         cspice_axisar, axis, cspice_halfpi(), r2

         cspice_mxmt, r2, r1, q
         cspice_raxisa, q, axis, angle

         ;;
         ;; Find the fraction of the total rotation angle that `r'
         ;; rotates through in the time interval [t1, t3].
         ;;
         frac = ( t3 - t1 )  /  ( t2 - t1 )

         ;;
         ;; Finally, find the rotation `delta' that r(t) undergoes
         ;; during the time interval [t1, t3], and apply that
         ;; rotation to `r1', yielding r(t3), which we'll call `r3'.
         ;;
         cspice_axisar, axis, frac * angle, delta
         cspice_mxm, delta, r1, r3

         ;;
         ;; Display the results.
         ;;
         print, format='(A,F10.5)',  'Time (s)            :', t3
         print, format='(A,3F10.5)', 'Rotation axis       :', axis
         print, format='(A,F10.5)', 'Rotation angle (deg):',                 $
                                    frac * angle * cspice_dpr()
         print, format='(A)', 'Rotation matrix     :'
         print
         print, format='(3F10.5)', r3

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Time (s)            :  30.00000
      Rotation axis       :   0.00000   0.00000   1.00000
      Rotation angle (deg):  45.00000
      Rotation matrix     :

         0.70711  -0.70711   0.00000
         0.70711   0.70711   0.00000
         0.00000   0.00000   1.00000


Particulars


   cspice_axisar can be thought of as a partial inverse of cspice_raxisa.
   cspice_axisar really is a `left inverse': the code fragment

      cspice_raxisa, r, axis, angle
      cspice_axisar, axis, angle, r

   preserves `r', except for round-off error, as long as `r' is a
   rotation matrix.

   On the other hand, the code fragment

      cspice_axisar, axis, angle, r
      cspice_raxisa, r, axis, angle

   preserves `axis' and `angle', except for round-off error, only if
   `angle' is in the range (0, pi). So cspice_axisar is a right inverse
   of cspice_raxisa only over a limited domain.

Exceptions


   1)  If `axis' is the zero vector, the rotation generated is the
       identity. This is consistent with the specification of cspice_vrotv.

   2)  If any of the input arguments, `axis' or `angle', is
       undefined, an error is signaled by the IDL error handling
       system.

   3)  If any of the input arguments, `axis' or `angle', is not of
       the expected type, or it does not have the expected dimensions
       and size, an error is signaled by the Icy interface.

   4)  If the output argument `r' is not a named variable, an error
       is signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ
   ROTATION.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.1, 17-JUN-2021 (JDR)

       Edited the header to comply with NAIF standard. Added complete
       code examples.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections, and
       completed -Particulars section.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   axis and angle to rotation



Fri Dec 31 18:43:02 2021