pro rot_comp, beta, x0, y0, dt, x, y
;+
; NAME :
;     ROT_COMP (rotation compensator)
; PURPOSE : 
;     When given a set of pointing coordinates X0 and Y0,
;     to find out  another set of pointing coordinates X 
;     and Y specifying the same point after a time delay DT
; CALLING SEQUENCE:
;     ROT_COMP, BETA, X0, Y0, DT, X, Y
; INPUT :
;     BETA : tilt angle (in unit of radians)
;     X0, Y0 : the  present pointing coordinates (in unit of
;         solar radius). origin = solar disk center.           
;         The Y-axis increases toward the solar north and parallel
;         to the projection of the solar axis.
;         The X-axis is directed toward the west.
;     DT : the time delay (in unit of day)
;          DT may have a negative value.     
; OUTPUT :
;     X, Y : the new pointing coordinates.
;             (in unit of solar radius)
; REFERENCE :
;     SOHO Mission, p228           
; MODIFICATION HISTORY:
;     May 22 1996  Jong-Chul Chae
;-                

; Basic Data ===================================

  g       = 0.250263  ; (radian/day)
  h       =-0.0497419 ; (radian/day)
  omega_e = 0.0172021 ; (radian/day)
  theta_0 = 0.261799  ; (radian)
;===============================================
  cosbeta = cos(beta)
  sinbeta = sin(beta)

  r2 = x0^2 + y0^2
  inside = where(r2 lt 1., n_inside)
  x = x0
  y = y0
  if n_inside ge 1 then begin
     sq = sqrt(1.-r2(inside))
     xprime =  x0(inside)
     yprime = -y0(inside)*cosbeta + sq*sinbeta
     theta  = asin(yprime)
     costheta = cos(theta)
     psi     = asin(xprime/costheta)
     dx = costheta*cos(psi) $
            *(g+h*(sin(theta)^2-sin(theta0)^2) - omega_e)*dt
     dy = -xprime*dx*sinbeta/(cosbeta*sq+y0(inside)*sinbeta)
     x(inside) = x0(inside) + dx
     y(inside) = y0(inside) + dy
  endif
return
end