dvhat_c |

## Procedurevoid dvhat_c ( ConstSpiceDouble s1 [6], SpiceDouble sout[6] ) ## AbstractFind the unit vector corresponding to a state vector and the derivative of the unit vector. ## Required_ReadingNone. ## KeywordsVECTOR DERIVATIVE MATH ## Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- s1 I State to be normalized. sout O Unit vector s1 / |s1|, and its time derivative. ## Detailed_Inputs1 This is any double precision state. If the position component of the state is the zero vector, this routine will detect it and will not attempt to divide by zero. ## Detailed_Outputsout sout is 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. sout may overwrite s1. ## ParametersNone. ## ExceptionsError free. 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. ## FilesNone. ## ParticularsLet 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. ## ExamplesAny 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. #include "SpiceUsr.h" #include <stdio.h> #include <math.h> int main() { SpiceDouble et; SpiceDouble ltime; SpiceDouble omega; SpiceDouble state [6]; SpiceDouble ustate [6]; SpiceChar * epoch = "Jan 1 2009"; SpiceChar * target = "MOON"; SpiceChar * frame = "J2000"; SpiceChar * abcorr = "LT+S"; SpiceChar * obsrvr = "EARTH BARYCENTER"; /. Load SPK, PCK, and LSK kernels, use a meta kernel for convenience. ./ furnsh_c ( "standard.tm" ); /. Define an arbitrary epoch, convert the epoch to ephemeris time. ./ str2et_c ( 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. ./ spkezr_c ( target, et, frame, abcorr, obsrvr, state, <ime ); /. Calculate the unit vector of STATE and the derivative of the unit vector. ./ ## RestrictionsNone. ## Literature_ReferencesNone. ## Author_and_InstitutionW.L. Taber (JPL) E.D. Wright (JPL) ## Version-CSPICE Version 1.0.1, 06-MAY-2010 (EDW) Reordered header sections to proper NAIF convention. Minor edit to code comments eliminating typo. -CSPICE Version 1.0.0, 07-JUL-1999 (EDW) ## Index_EntriesState of a unit vector parallel to a state vector |

Wed Apr 5 17:54:33 2017