function uniform_in_polygon_convex_test ( )

%*****************************************************************************80
%
%% uniform_in_polygon_convex_test() tests uniform_in_polygon_convex().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 January 2025
%
%  Author:
%
%    John Burkardt
%
  n = 1000;
  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 ]; 

  fprintf ( 1, '\n' );
  fprintf ( 1, 'uniform_in_polygon_convex_test():\n' );
  fprintf ( 1, '  uniform_in_polygon_convex() maps uniform\n' );
  fprintf ( 1, '  points into a convex polygon.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of points N =    %12d\n', n );
  fprintf ( 1, '  Number of vertices NV = %12d\n', nv );
  fprintf ( 1, '  Polygonal vertices:\n' );
  disp ( v )

  p = uniform_in_polygon_convex ( n, nv, v );

  clf ( );
  hold ( 'on' );
  im1 = nv
  for i = 1 : nv
    plot ( [ v(im1,1), v(i,1) ], ...
           [ v(im1,2), v(i,2) ], 'r-', 'linewidth', 3 );
    im1 = i;
  end
  plot ( p(:,1), p(:,2), 'bo' );
  hold ( 'off' );
  xlabel ( '<--- X --->' );
  ylabel ( '<--- Y --->' );
  title ( 'uniform\_in\_polygon\_convex()' );
  grid ( 'on' );
  axis ( 'equal' );
  filename = 'uniform_in_polygon_convex.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end
