function tetrahedron_sample_3d_test ( )

%*****************************************************************************80
%
%% TETRAHEDRON_SAMPLE_3D_TEST tests TETRAHEDRON_SAMPLE_3D.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    18 January 2007
%
%  Author:
%
%    John Burkardt
%
  seed = 123456789;
  t = [ ...
     1.0, 4.0, 3.0; ...
     2.0, 4.0, 3.0; ...
     1.0, 6.0, 3.0; ...
     1.0, 4.0, 4.0 ]';

  fprintf ( 1, '\n' );
  fprintf ( 1, 'TETRAHEDRON_SAMPLE_3D_TEST\n' );
  fprintf ( 1, '  TETRAHEDRON_SAMPLE_3D samples a tetrahedron.\n' );
  fprintf ( 1, '  We are computing the XSI coordinates just to verify\n' );
  fprintf ( 1, '  that the points are inside the tetrahedron.\n' );

  r8mat_transpose_print ( 3, 4, t, '  Tetrahedron vertices' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  (X,Y,Z)   (XSI1,XSI2,XSI3,XSI4):\n' );
  fprintf ( 1, '\n' );

  for i = 1 : 10
    [ p, seed ] = tetrahedron_sample_3d ( t, 1, seed );
    xsi = tetrahedron_barycentric_3d ( t, p );
    fprintf ( 1, '  %8f  %8f  %8f    %8f  %8f  %8f  %8f\n', p(1:3), xsi(1:4) );
  end

  return
end
