function exact_min_bound_circle_test ( )

%*****************************************************************************80
%
%% exact_min_bound_circle_test() tests exact_min_bound_circle()
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 December 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'exact_min_bound_circle_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  exact_min_bound_circle() computes the exact minimal\n' );
  fprintf ( 1, '  bounding circle of a set of points.\n' );
%
%  Choose points already on a circle.
%
  r1 = 5.0 * rand ( );
  c1 = 5.0 * randn ( 1, 2 );
  n = 10;
  T = rand ( n, 1 ); 
  X(:,1) = r1 * cos ( 2.0 * pi * T(:) ) + c1(1,1);
  X(:,2) = r1 * sin ( 2.0 * pi * T(:) ) + c1(1,2);

  hold ( 'on' );
  plot ( X(:,1), X(:,2), 'ro' );

  [ r2, c2, Xb ] = exact_min_bound_circle ( X );

  T = linspace ( 0.0, 2.0 * pi, 101 );
  X2(:,1) = r2 * cos ( T(:) ) + c2(1,1);
  X2(:,2) = r2 * sin ( T(:) ) + c2(1,2);
  plot ( X2(:,1), X2(:,2), 'b-' );
  hold ( 'off' );
  axis ( 'equal' );
  grid ( 'on' );
  filename = 'exact_min_bound_circle_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Compare data and bounding data.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  r1 = %g\n', r1 );
  fprintf ( 1, '  c1 = (%g,%g)\n', c1 );
  fprintf ( 1, '  X:\n' );
  X

  fprintf ( 1, '\n' );
  fprintf ( 1, '  r2 = %g\n', r2 );
  fprintf ( 1, '  c2 = (%g,%g)\n', c2 );
  fprintf ( 1, '  Xb:\n' );
  Xb
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'exact_min_bound_circle():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

