      subroutine fixell(p,r,npts,a,rfit,x,y,maxpts)
      implicit undefined(a-z)
      integer*4 maxpts,i
      real*8 r(maxpts),p(maxpts),rfit(maxpts),dx,dy
      real*8 a(5)
      real*8 esqr
      integer*4 npts
c--centx=a1,centy=a2,position angle=a3,major axis=a4,minor axis=a5
      real*8 x(maxpts),y(maxpts)
      do i=1,npts
       dx=-x(i)-a(1)
       dy=y(i)-a(2)
       r(i)=sqrt(dx**2+dy**2)
       p(i)=atan2(dy,dx)-a(3)
       esqr=1.-a(5)*a(5)/(a(4)*a(4))
       rfit(i)=sqrt(a(5)*a(5)/(1.-esqr*cos(p(i))*cos(p(i))))
      enddo
      return
      end
