From d54fe7c1f704a63824c5bfa0ece65245572e9b27 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 4 Mar 2015 21:21:30 -0500 Subject: Initial commit --- src/libcf/space_vel.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/libcf/space_vel.c (limited to 'src/libcf/space_vel.c') diff --git a/src/libcf/space_vel.c b/src/libcf/space_vel.c new file mode 100644 index 0000000..e472961 --- /dev/null +++ b/src/libcf/space_vel.c @@ -0,0 +1,46 @@ +/***************************************************************************** + * Johns Hopkins University + * Center For Astrophysical Sciences + * FUSE + ***************************************************************************** + * + * Synopsis: double space_vel(double *vel, double ra, double dec) + * + * Description: Computes the projection of the spacecraft orbital velocity + * vector onto a unit vector in the direction ra, dec. + * + * Arguments: double *vel (km/s) 3-vector velocity of satellite + * double ra,dec (deg) position of target + * + * Returns: double (km/s) velocity in direction of target + * + * History: 03/04/98 E. Murphy Begin work. + * 03/04/98 E. Murphy Initial version working + * 07/07/99 E. Murphy Converted x,y,z and vx,vy,vz to pos,vel + * 06/15/01 V. Dixon Comment out calculation of r, not used. + * 12/18/03 bjg Change calfusettag.h to calfuse.h + * 07/21/04 1.4 wvd Delete defn of r, as it is not used. + * 03/04/07 1.5 wvd Rewrite program to compute dot product + * of target and velocity vectors. + * + ****************************************************************************/ + +#include +#include "calfuse.h" + +double space_vel(double vel[3], double ra, double dec) +{ + + double x, y, z, phi; + + ra *= RADIAN; + dec *= RADIAN; + + z = sin(dec); + phi = cos(dec); + y = phi * sin(ra); + x = phi * cos(ra); + + return x*vel[0] + y*vel[1] + z*vel[2]; + +} -- cgit