diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/astutil/asttools/astarcsep.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/astutil/asttools/astarcsep.x')
-rw-r--r-- | noao/astutil/asttools/astarcsep.x | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/noao/astutil/asttools/astarcsep.x b/noao/astutil/asttools/astarcsep.x new file mode 100644 index 00000000..023fd20f --- /dev/null +++ b/noao/astutil/asttools/astarcsep.x @@ -0,0 +1,33 @@ +include <math.h> + +# AST_ARCSEP -- Arc distance (arcsec) between two spherical coordinates +# (hours,deg). + +double procedure ast_arcsep (ra1, dec1, ra2, dec2) + +double ra1 # Right ascension (hours) +double dec1 # Declination (degrees) +double ra2 # Right ascension (hours) +double dec2 # Declination (degrees) + +double a1, b1, c1, a2, b2, c2 + +begin + # Direction cosines + a1 = cos (DEGTORAD (15D0 * ra1)) * cos (DEGTORAD (dec1)) + b1 = sin (DEGTORAD (15D0 * ra1)) * cos (DEGTORAD (dec1)) + c1 = sin (DEGTORAD (dec1)) + + a2 = cos (DEGTORAD (15D0 * ra2)) * cos (DEGTORAD (dec2)) + b2 = sin (DEGTORAD (15D0 * ra2)) * cos (DEGTORAD (dec2)) + c2 = sin (DEGTORAD (dec2)) + + # Modulus squared of half the difference vector. + a1 = ((a1-a2)**2 + (b1-b2)**2 + (c1-c2)**2) / 4 + + # Angle + a1 = 2D0 * atan2 (sqrt (a1), sqrt (max (0D0, 1D0-a1))) + a1 = RADTODEG (a1) * 3600D0 + + return (a1) +end |