diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-03-04 21:21:30 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-03-04 21:21:30 -0500 |
commit | d54fe7c1f704a63824c5bfa0ece65245572e9b27 (patch) | |
tree | afc52015ffc2c74e0266653eecef1c8ef8ba5d91 /src/libcf/space_vel.c | |
download | calfuse-d54fe7c1f704a63824c5bfa0ece65245572e9b27.tar.gz |
Initial commit
Diffstat (limited to 'src/libcf/space_vel.c')
-rw-r--r-- | src/libcf/space_vel.c | 46 |
1 files changed, 46 insertions, 0 deletions
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 <math.h> +#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]; + +} |