      SUBROUTINE GNOMONIC(TRA,TDEC,ZRA,ZDEC,CSI,ETA)
C
C----------------------------------------------------------------------
C.IDENTIFICATION: Subroutine GNOMONIC
C.LIBRARY:        GENERAL      
C.AUTHOR:         L.Chiappetti - IFCTR Milano
C.VERSIONS:       0.0 - 25 Aug 97 - original version
C.PURPOSE:        compute gnomonic (angular) coordinates
C.METHOD:         trigonometry
C.SYNTAX:         CALL  GNOMONIC(TRA,TDEC,ZRA,ZDEC,CSI,ETA)
C.PARAMETERS:     REAL*8 TRA,TDEC     wished target position (in)
C                 REAL*8 ZRA,ZDEC     pointing position (in)
C                 REAL*8 CSI,ETA      gnomonic (angular) coordinates (out)
C.NOTES:          all angular quantities must be / are returned in RADIANS
C                 Gnomonic coordinates are angular in natural (unrolled) reference
C.REFERENCES:     C A Murray, Vectorial Astrometry, pag. 191 ff.
C----------------------------------------------------------------------
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DOUBLE PRECISION U(3),V(3),W(3),R(3)
      U(1)= -SIN(ZRA)
      U(2)=  COS(ZRA)
      U(3)=  0.0
      V(1)= -SIN(ZDEC)*COS(ZRA)
      V(2)= -SIN(ZDEC)*SIN(ZRA)
      V(3)=  COS(ZDEC)
      W(1)=  COS(ZDEC)*COS(ZRA)
      W(2)=  COS(ZDEC)*SIN(ZRA)
      W(3)=  SIN(ZDEC)
      R(1)=  COS(TDEC)*COS(TRA)
      R(2)=  COS(TDEC)*SIN(TRA)
      R(3)=  SIN(TDEC)
      UR= DOTPRODUCT(U,R,3)
      VR= DOTPRODUCT(V,R,3)
      WR= DOTPRODUCT(W,R,3)
      CSI=UR/WR
      ETA=VR/WR
      RETURN
      END
