function point_line_distance_signed_test ( )

%*****************************************************************************80
%
%% point_line_distance_signed_test() demonstrates point and line distance.
%
%  Discussion:
%
%    The program
%    * reads a line L (defined by two points),
%    * computes and prints the length of the direction vector
%    * computes and prints the unit normal vector
%    * reads a point P
%    * computes the signed distance from P to L.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 July 2023
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'point_line_distance_signed_test():\n' );
  fprintf ( 1, '  Compute signed distance between a point P and a line L\n' );
  fprintf ( 1, '  defined by points P1 and P2.\n' );

  for i = 1 : 5

    p = randn ( 2, 1 );
    p1 = randn ( 2, 1 );
    p2 = randn ( 2, 1 );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  P  = (%g,%g)\n', p );
    fprintf ( 1, '  P1 = (%g,%g)\n', p1 );
    fprintf ( 1, '  P2 = (%g,%g)\n', p2 );

    l_p_dist = point_line_distance_signed ( p1, p2, p );

    fprintf ( 1, '  Distance from P to line (P1,P2) = %d\n', l_p_dist );

  end

  return
end

