function vector2d_angle_sort_test ( )

%*****************************************************************************80
%
%% vector2d_angle_sort_test() tests vector2d_angle_sort().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 November 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'vector2d_angle_sort_test():\n' );
  fprintf ( 1, '  vector2d_angle_sort() sorts 2D vectors by angle.\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Unsorted vectors:\n' );
  u = rand ( 10, 2 );
  disp ( u );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Radians / degrees for unsorted vectors:\n' );
  rad = atan2 ( u(:,2), u(:,1) );
  deg = rad * 180.0 / pi;
  disp ( [ rad, deg ] );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Radians / degrees sorted:\n' );
  rad_sorted = sort ( rad );
  deg_sorted = rad_sorted * 180.0 / pi;
  disp ( [ rad_sorted, deg_sorted ] );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Vectors sorted by angle:\n' );
  u2 = vector2d_angle_sort ( u );
  disp ( u2 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Radians / degrees for sorted vectors:\n' );
  rad = atan2 ( u2(:,2), u2(:,1) );
  deg = rad * 180.0 / pi;
  disp ( [ rad, deg ] );

  return
end

