    	SUBROUTINE IFROTA( ANGX, ANGY )
C
C  PROGRAMMER: R.S. ZHOU	ALFRED UNIVERISTY, DEC-1985
C
C  	THIS ROUTINE SETS THE REFERENCE ROTATION OF X,Y AXES.
C
C  	ANGX ---- ROTATION ANGLE IN DEGREES OF X-AXIS FROM HORIZONTAL.
C  	ANGY ---- ROTATION ANGLE IN DEGREES OF Y-AXIS FROM VERTICAL.
C
    	INCLUDE 'TEKLIB.CBS'

    	XANG = AMOD( ANGX, 360.0 )
    	YANG = AMOD( ANGY, 360.0 )
    	XCTH = COS( XANG*D2R )
    	XSTH = SIN( XANG*D2R )
    	YCTH = COS( YANG*D2R )
    	YSTH = SIN( YANG*D2R )

     	IF( IDW.NE.0 ) THEN
     	    IF( NPPS.GT.0 ) CALL IFPLOT_DUMP
     	    WRITE(IDF,1000) XANG, YANG
     	ENDIF
1000	FORMAT('ROTA:',2F8.3)

999	RETURN
    	END

     	SUBROUTINE IFROTA_NOW( ANGX, ANGY )
C
C	THIS ROUITNE REPORTS CURRENT GRAPH ROTATIONS IN ANGX,ANGY
C
     	INCLUDE 'TEKLIB.CBS'

     	ANGX = XANG
     	ANGY = YANG

999	RETURN
     	END

    	REAL*4 FUNCTION IFROTA_DIST( X1, Y1, X2, Y2 )
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERISTY, DEC-1985
C
C  	THIS ROUTINE CALCULATES THE ABSOLUTE DISTANCE
C	BETWEEN TWO POINTS WITH COORDINATES THAT MAY
C	NOT BE IN NORMAL CARTESIAN COORDINATE SYSTEM.
C
    	INCLUDE 'TEKLIB.CBS'

     	X11 = X1*XCTH - Y1*YSTH
     	Y11 = X1*XSTH - Y1*YCTH
     	X22 = X2*XCTH - Y2*YSTH
     	Y22 = X2*XSTH - Y2*YCTH
     	IFROTA_DIST = SQRT( (X22-X11)**2 + (Y22-Y11)**2 )

    	RETURN
    	END

