aboutsummaryrefslogtreecommitdiff
path: root/noao/astutil/asttools/astvr.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/astutil/asttools/astvr.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/astutil/asttools/astvr.x')
-rw-r--r--noao/astutil/asttools/astvr.x29
1 files changed, 29 insertions, 0 deletions
diff --git a/noao/astutil/asttools/astvr.x b/noao/astutil/asttools/astvr.x
new file mode 100644
index 00000000..f2139b59
--- /dev/null
+++ b/noao/astutil/asttools/astvr.x
@@ -0,0 +1,29 @@
+include <math.h>
+
+# AST_VR -- Project a velocity vector in radial velocity along line of sight.
+
+procedure ast_vr (ra1, dec1, v1, ra2, dec2, v2)
+
+double ra1 # Right ascension of velocity vector (hours)
+double dec1 # Declination of velocity vector (degrees)
+double v1 # Magnitude of velocity vector
+double ra2 # Right ascension of observation (hours)
+double dec2 # Declination of observation (degrees)
+double v2 # Radial velocity along direction of observation
+
+double vx, vy, vz, cc, cs, s
+
+begin
+ # Cartisian velocity components of the velocity vector.
+ vx = v1 * cos (DEGTORAD (15. * ra1)) * cos (DEGTORAD (dec1))
+ vy = v1 * sin (DEGTORAD (15. * ra1)) * cos (DEGTORAD (dec1))
+ vz = v1 * sin (DEGTORAD (dec1))
+
+ # Direction cosines along the direction of observation.
+ cc = cos (DEGTORAD (dec2)) * cos (DEGTORAD (15. * ra2))
+ cs = cos (DEGTORAD (dec2)) * sin (DEGTORAD (15. * ra2))
+ s = sin (DEGTORAD (dec2))
+
+ # Project velocity vector along the direction of observation.
+ v2 = (vx * cc + vy * cs + vz * s)
+end