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_dvhat

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


Abstract


   CSPICE_DVHAT calculates the unit vector corresponding to a state and
   the time derivative of the unit vector.

I/O


   Given:

      s1       any double precision state.

               help, s1
                  DOUBLE = Array[6]

               If the position component of the state is the zero vector, this
               routine will detect it and will not attempt to divide by zero.

   the call:

      cspice_dvhat, s1, sout

   returns:

      sout     a state containing the unit vector pointing in the direction of
               position component of `s1' and the derivative of the unit vector
               with respect to time.

               help, sout
                  DOUBLE = Array[6]

               `sout' may overwrite `s1'.

Parameters


   None.

Examples


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

   1) Suppose that `state' gives the apparent state of a body with
      respect to an observer. This routine can be used to compute the
      instantaneous angular rate of the object across the sky as seen
      from the observers vantage.

      Use the meta-kernel shown below to load the required SPICE
      kernels.


         KPL/MK

         File name: dvhat_ex1.tm

         This meta-kernel is intended to support operation of SPICE
         example programs. The kernels shown here should not be
         assumed to contain adequate or correct versions of data
         required by SPICE-based user applications.

         In order for an application to use this meta-kernel, the
         kernels referenced here must be present in the user's
         current working directory.

         The names and contents of the kernels referenced
         by this meta-kernel are as follows:

            File name                     Contents
            ---------                     --------
            de421.bsp                     Planetary ephemeris
            pck00008.tpc                  Planet orientation and
                                          radii
            naif0009.tls                  Leapseconds


         \begindata

            KERNELS_TO_LOAD = ( 'de421.bsp',
                                'pck00008.tpc',
                                'naif0009.tls'  )

         \begintext

         End of meta-kernel


      Example code begins here.


      PRO dvhat_ex1

         ;;
         ;; Load SPK, PCK, and LSK kernels, use a meta kernel for
         ;; convenience.
         ;;
         cspice_furnsh, 'dvhat_ex1.tm'

         ;;
         ;; Define an arbitrary epoch, convert the epoch to ephemeris time.
         ;;
         EPOCH = 'Jan 1 2009'
         cspice_str2et, EPOCH, et

         ;;
         ;; Calculate the state of the moon with respect to the earth-moon
         ;; barycenter in J2000, corrected for light time and stellar
         ;; aberration at `et'.
         ;;
         target   = 'MOON'
         frame    = 'J2000'
         abcorr   = 'LT+S'
         observer = 'EARTH BARYCENTER'

         cspice_spkezr, target, et, frame, abcorr, observer, state, ltime

         ;;
         ;; Calculate the unit vector of `state' and the derivative of the
         ;; unit vector.
         ;;
         cspice_dvhat, state, ustate

         ;;
         ;; Calculate the instantaneous angular velocity from the magnitude
         ;; of the derivative of the unit vector.
         ;;
         ;;   v = r x omega
         ;;
         ;;   ||omega|| = ||v||  for  r . v = 0
         ;;               -----
         ;;               ||r||
         ;;
         ;;   ||omega|| = ||v||  for  ||r|| = 1
         ;;
         omega = cspice_vnorm( ustate[3:5] )

         print, 'Instantaneous angular velocity, rad/sec', omega

         ;;
         ;; It's always good form to unload kernels after use,
         ;; particularly in IDL due to data persistence.
         ;;
         cspice_kclear

      END


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


      Instantaneous angular velocity, rad/sec   2.4810666e-06


Particulars


   Let `s1' be a state vector with position and velocity components P
   and V respectively. From these components one can compute the
   unit vector parallel to P, call it U and the derivative of U
   with respect to time, DU. This pair (U,DU) is the state returned
   by this routine in `sout'.

Exceptions


   1)  If `s1' represents the zero vector, then the position
       component of `sout' will also be the zero vector. The
       velocity component will be the velocity component
       of `s1'.

   2)  If the input argument `s1' is undefined, an error is signaled
       by the IDL error handling system.

   3)  If the input argument `s1' 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 `sout' is not a named variable, an
       error is signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


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

Version


   -Icy Version 1.0.6, 10-AUG-2021 (JDR)

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections. Edited the
       header to comply with NAIF standard.

       Added meta-kernel to the example. Added -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.5, 09-MAY-2016 (EDW)

       Eliminated typo in example code; no change to functionality.

   -Icy Version 1.0.4, 04-MAY-2010 (EDW)

       Added complete example code.

   -Icy Version 1.0.3, 03-DEC-2009 (EDW)

       Edited header, improved/clarified -I/O descriptions.

   -Icy Version 1.0.2, 09-DEC-2005 (EDW)

       Added -Examples section.

   -Icy Version 1.0.1, 10-OCT-2005 (EDW)

       Corrected notation |r| to ||r||; edited header.

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

Index_Entries


   State of a unit vector parallel to a state vector



Fri Dec 31 18:43:03 2021