aboutsummaryrefslogtreecommitdiff
path: root/noao/astutil/asttools/astvr.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /noao/astutil/asttools/astvr.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
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