function annulus_grid_test01 ( )

%*****************************************************************************80
%
%% annulus_grid_test01() tests annulus_grid().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 November 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'annulus_grid_test01():\n' );
  fprintf ( 1, '  annulus_grid() defines a grid of points\n' );
  fprintf ( 1, '  with N+1 points on a horizontal or vertical radius,\n' );
  fprintf ( 1, '  based on any annulus.\n' );

  n = 20;
  r1 = 1.0;
  r2 = 2.0;
  c = [ 1.0, 5.0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  We use N = %d\n', n );
  fprintf ( 1, '  Inner radius R1 = %f\n', r1 );
  fprintf ( 1, '  Outer radius R2 = %f\n', r2 );
  fprintf ( 1, '  Center C = (%f,%f)\n', c(1), c(2) );

  ng = annulus_grid_count ( n, r1, r2, c );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of grid points will be %d\n', ng );

  cg = annulus_grid ( n, r1, r2, c, ng );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  First 20 points:\n' );
  disp ( cg(1:20,1:2) );

  filename = 'annulus_grid_test01.xy';
  save ( filename, 'cg', '-ascii' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Data written to the file "%s".\n', filename );
%
% Plot the points.
%
  i = 0 : 50;
  t = 2.0 * pi * i / 50.0;

  cx1 = c(1) + r1 .* cos ( t );
  cy1 = c(2) + r1 .* sin ( t );

  cx2 = c(1) + r2 .* cos ( t );
  cy2 = c(2) + r2 .* sin ( t );

  figure ( );
  clf ( );
  hold ( 'on' );
  plot ( cx1, cy1, 'r-', 'Linewidth', 3 );
  plot ( cx2, cy2, 'r-', 'Linewidth', 3 );
  plot ( cg(1:ng,1), cg(1:ng,2), 'b.' );
  hold ( 'off' );
  axis ( 'equal' );
  xlabel ( '<---X--->', 'Fontsize', 16 );
  ylabel ( '<---Y--->', 'Fontsize', 16 );
  title ( sprintf ( 'Circle grid with %d points', ng ), 'Fontsize', 16 );
  filename = 'annulus_grid_test01.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end
