function [ r, t ] = xy_to_polar ( xy )

%*****************************************************************************80
%
%% xy_to_polar() converts XY coordinates to polar coordinates.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 December 2010
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real XY(2,1), the Cartesian coordinates.
%
%  Output:
%
%    real R, T, the radius and angle (in radians).
%
  r = norm ( xy );

  if ( r == 0.0 )
    t = 0.0;
  else
    t = atan2 ( xy(2,1), xy(1,1) );
  end

  return
end
