function polygon_sample_test ( )

%*****************************************************************************80
%
%% polygon_sample_test() tests polygon_sample().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 June 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polygon_sample_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test polygon_sample().\n' );

  nv = 10;

  v = [ ...
    [0.0; 0.0], ...
    [0.5; 0.3], ...
    [1.0; 0.0], ...
    [0.7; 0.4], ...
    [1.0; 0.6], ...
    [0.6; 0.6], ...
    [0.5; 1.0], ...
    [0.4; 0.6], ...
    [0.0; 0.6], ...
    [0.3; 0.4] ]; 

  r8mat_transpose_print ( 2, nv, v, '  Polygonal vertices:' );

  np = 100;
  p = polygon_sample ( nv, v, np );

  if ( false )
    r8mat_transpose_print ( 2, np, p, '  Sample points:' );
  end

  clf ( );
  hold ( 'on' );
  plot ( [v(1,:),v(1,1)], [v(2,:),v(2,1)], 'k-', 'linewidth', 3 );
  plot ( p(1,:), p(2,:), 'r*' );
  grid ( 'on' );
  xlabel ( '<-- X -->', 'fontsize', 12 );
  ylabel ( '<-- Y -->', 'fontsize', 12 );
  title ( 'Polygon sample points', 'fontsize', 16 );
  axis ( 'equal' );
  hold ( 'off' );
  filename = 'polygon_sample_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  pause ( 5 );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polygon_sample_test\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
