*
* $Id: ulangl.F,v 1.1.1.1 1996/01/11 14:05:24 mclareni Exp $
*
* $Log: ulangl.F,v $
* Revision 1.1.1.1  1996/01/11 14:05:24  mclareni
* Fritiof
*
*
C*********************************************************************
 
      FUNCTION ULANGL(X,Y)
 
C...Purpose: to reconstruct an angle from given x and y coordinates.
      COMMON/LUDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200)
      SAVE /LUDAT1/
 
      ULANGL=0.
      R=SQRT(X**2+Y**2)
      IF(R.LT.1E-20) RETURN
      IF(ABS(X)/R.LT.0.8) THEN
        ULANGL=SIGN(ACOS(X/R),Y)
      ELSE
        ULANGL=ASIN(Y/R)
        IF(X.LT.0..AND.ULANGL.GE.0.) THEN
          ULANGL=PARU(1)-ULANGL
        ELSEIF(X.LT.0.) THEN
          ULANGL=-PARU(1)-ULANGL
        ENDIF
      ENDIF
 
      RETURN
      END
