      program KtoKp ! bb aug 10 2017.
c Problem 1: rotation in 2d Euclidean space.
      implicit real*8 (a-h,o-z)
      parameter(iuo=6)
      pi=acos(-1.d00)
      phi=pi/8.d00
      write(iuo,'(/," 2d rotation phi=pi/8:")')
      x=1.d00
      y=1.d00
      call rot2d(phi,x,y,xp,yp) 
      write(iuo,'(/," x,y,xp,ypg =",4g14.6)') x,y,xp,yp
      x=2.d00
      y=2.d00
      call rot2d(phi,x,y,xp,yp) 
      write(iuo,'(/," x,y,xp,ypg =",4g14.6,/)') x,y,xp,yp
      stop "KtoKp all done."
      end

      subroutine rot2d(phi,x,y,xp,yp)
      implicit real*8 (a-h,o-z)
      xp=+x*cos(phi)+y*sin(phi)
      yp=-x*sin(phi)+y*cos(phi)
      return
      end
