function triangle_distance_test ( )

%*****************************************************************************80
%
%% triangle_distance_test() tests triangle_distance().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 July 2023
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'triangle_distance_test():\n' );
  fprintf ( 1, '  triangle_distance() reports the distance from\n' );
  fprintf ( 1, '  a point P to a triangle T.\n' );

  test_num = 5;

  p_test = [
    -2.0, 1.0;
     0.0, 2.0;
     2.0, 3.0;
     4.0, 4.0;
     6.0, 5.0 ];

  t = [ ...
     0.0, 2.0; ...
     4.0, 1.0; ...
     3.0, 5.0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Triangle vertices:\n' );
  disp ( t );

  fprintf ( 1, '\n' );
  fprintf ( 1, '       P              Distance\n' );
  fprintf ( 1, '\n' );

  for i = 1 : test_num
    p = p_test(i,1:2);
    d = triangle_distance ( t, p );
    fprintf ( 1, '  %10f  %10f  %10f\n', p, d );
  end

  return
end
