function polygon_point_near_test ( )

%*****************************************************************************80
%
%% POLYGON_POINT_NEAR_TEST tests POLYGON_POINT_NEAR.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    15 October 2015
%
%  Author:
%
%    John Burkardt
%
  n = 3
 
  p_test = [ ...
    4.0,  5.0; ...
    2.0,  3.0; ...
   -2.0, -1.0 ]';
  v = [ ...
    1.0, 1.0; ...
    4.0, 3.0; ...
    2.0, 5.0 ]';

  fprintf ( 1, '\n' );
  fprintf ( 1, 'POLYGON_POINT_NEAR_TEST\n' );
  fprintf ( 1, '  POLYGON_POINT_NEAR computes nearest point on polygon.\n' );

  r8mat_transpose_print ( 2, n, v, '  Vertices of polygon:' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '       X             Y             XN             YN\n' );
  fprintf ( 1, '\n' );

  for test = 1 : 3

    p(1:2) = p_test(1:2,test);
    [ pn, dist ] = polygon_point_near ( n, v, p );
    fprintf ( 1, '  %14.6g  %14.6g  %14.6g  %14.6g\n', p(1:2), pn(1:2) );

  end

  return
end
