C   11/12/78 008201337  MEMBER NAME  COORD                  FORTRAN
      SUBROUTINE COORD(X,DX)
C---  COMPUTE X- AND Y-COORDINATES WHEN Z, STARTING POINT,
C     AND DIRECTIONS ARE GIVEN (ALL DISTANCES IN MM)
C
C     H.WRIEDT    11.12.78      19:15
C     LAST MODIFICATION    29.05.80      19:45
C
      DIMENSION X(3), DX(3)
      COMMON /CPARTC/ PRTCIN,PRTCL,EMEV,AMASS2,ISIGNZ,EBEAM,THETA,PHIDEG
      DIMENSION PRTCIN(9), PRTCL(3,3)
      DATA PIHALF /1.57079632/, PI/3.14159264/
      DATA RADIAN/1.745329E-2/
C
        DO 10 J = 1,3
 10     DX(J) = PRTCL(J,3)
C
      PHI = PHIDEG*RADIAN
      PHI0 = 0.
      IF (PHI.GE.PIHALF) PHI0 = PI
      IF (PHI.LT.-PIHALF) PHI0 = -PI
      PHI1 = -PIHALF
      IF (DX(1).NE.0.) PHI1 = ATAN(DX(2)/DX(1))
      PHI1 = PHI1+PHI0
C
      X(3) = ISIGNZ*X(3)
      THESIN = X(3)*SIN(ARCOS(DX(3)))
      X(1) = PRTCL(1,2)+THESIN*COS(PHI1)
      X(2) = PRTCL(2,2)+THESIN*SIN(PHI1)
      RETURN
      END
