function uniform_on_sphere_triangle_test ( )

%*****************************************************************************80
%
%% uniform_on_sphere_triangle_test() tests uniform_on_sphere_triangle().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 April 2022
%
%  Author:
%
%    John Burkardt
%
  n = 500;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'uniform_on_sphere_triangle_test():\n' );
  fprintf ( 1, '  uniform_on_sphere_triangle() maps uniform\n' );
  fprintf ( 1, '  points onto a spherical triangle using XYZ coordinates.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of points N =          %12d\n', n );

  v1 = [ 1.0, 0.0, 0.0 ];
  v2 = [ 0.0, 1.0, 0.0 ];
  v3 = [ 0.0, 0.0, 1.0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Vertices of the spherical triangle:\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  V1:  %10f  %10f  %10f\n', v1(1:3) );
  fprintf ( 1, '  V2:  %10f  %10f  %10f\n', v2(1:3) );
  fprintf ( 1, '  V3:  %10f  %10f  %10f\n', v3(1:3) );

  p = uniform_on_sphere_triangle ( n, v1, v2, v3 );
%
%  Make a plot.
%
  clf ( );
  scatter3 ( p(:,1), p(:,2), p(:,3), 'b', 'filled' );
  grid ( 'on' );
  axis ( 'equal' );
  xlabel ( '<--- X --->' );
  ylabel ( '<--- Y --->' );
  zlabel ( '<--- Z --->' );
  title ( 'uniform\_on\_sphere\_triangle()' );
  filename = 'uniform_on_sphere_triangle.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s".\n', filename );

  return
end
