diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /math/slalib/ds2tp.f | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'math/slalib/ds2tp.f')
-rw-r--r-- | math/slalib/ds2tp.f | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/math/slalib/ds2tp.f b/math/slalib/ds2tp.f new file mode 100644 index 00000000..ee8104d7 --- /dev/null +++ b/math/slalib/ds2tp.f @@ -0,0 +1,85 @@ + SUBROUTINE slDSTP (RA, DEC, RAZ, DECZ, XI, ETA, J) +*+ +* - - - - - - +* D S T P +* - - - - - - +* +* Projection of spherical coordinates onto tangent plane: +* "gnomonic" projection - "standard coordinates" (double precision) +* +* Given: +* RA,DEC dp spherical coordinates of point to be projected +* RAZ,DECZ dp spherical coordinates of tangent point +* +* Returned: +* XI,ETA dp rectangular coordinates on tangent plane +* J int status: 0 = OK, star on tangent plane +* 1 = error, star too far from axis +* 2 = error, antistar on tangent plane +* 3 = error, antistar too far from axis +* +* P.T.Wallace Starlink 18 July 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RA,DEC,RAZ,DECZ,XI,ETA + INTEGER J + + DOUBLE PRECISION SDECZ,SDEC,CDECZ,CDEC, + : RADIF,SRADIF,CRADIF,DENOM + + DOUBLE PRECISION TINY + PARAMETER (TINY=1D-6) + + +* Trig functions + SDECZ=SIN(DECZ) + SDEC=SIN(DEC) + CDECZ=COS(DECZ) + CDEC=COS(DEC) + RADIF=RA-RAZ + SRADIF=SIN(RADIF) + CRADIF=COS(RADIF) + +* Reciprocal of star vector length to tangent plane + DENOM=SDEC*SDECZ+CDEC*CDECZ*CRADIF + +* Handle vectors too far from axis + IF (DENOM.GT.TINY) THEN + J=0 + ELSE IF (DENOM.GE.0D0) THEN + J=1 + DENOM=TINY + ELSE IF (DENOM.GT.-TINY) THEN + J=2 + DENOM=-TINY + ELSE + J=3 + END IF + +* Compute tangent plane coordinates (even in dubious cases) + XI=CDEC*SRADIF/DENOM + ETA=(SDEC*CDECZ-CDEC*SDECZ*CRADIF)/DENOM + + END |