CSPICE_DVHAT calculates the unit vector corresponding to a state and
the time derivative of the unit vector.
For important details concerning this module's function, please refer to
the CSPICE routine dvhat_c.
Given:
s1 a double precision 6vector defining a state;
s1 = (r1, dr1 ).

dt
the call:
cspice_dvhat, s1, sout
returns:
sout a double precision 6vector containing the unit vector pointing
in the direction of position component of 's1' and the derivative
of the unit vector with respect to time;
sout = [u, du ] where u = r1
 
dt r1
'sout' may overwrite 's1'.
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.
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.
;;
;; Load SPK, PCK, and LSK kernels, use a meta kernel for convenience.
;;
cspice_furnsh, 'standard.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 earthmoon
;; 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
IDL outputs:
Instantaneous angular velocity, rad/sec 2.4810666e06
None.
ICY.REQ
Icy Version 1.0.1, 09MAY2016, EDW (JPL)
Eliminated typo in example code; no change to functionality.
Icy Version 1.0.4, 04MAY2010, EDW (JPL)
Added complete example code.
Icy Version 1.0.3, 03DEC2009, EDW (JPL)
Edited header, improved/clarified I/O descriptions.
Icy Version 1.0.2, 09DEC2005, EDW (JPL)
Added Examples section.
Icy Version 1.0.1, 10OCT2005, EDW (JPL)
Corrected notation r to r; edited header.
Icy Version 1.0.0, 16JUN2003, EDW (JPL)
State of a unit vector parallel to a state vector
