function polyiamond_triangle_print ( p, label )

%*****************************************************************************80
%
%% polyiamond_triangle_print prints the triangles that form a polyiamond.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    07 September 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer P(M,3), the IJK parallelogram triangle coordinates of the 
%    triangles making up the polyiamond.  
%
%    string LABEL, a label to be printed.  
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '%s\n', label );
  fprintf ( 1, '\n' );

  [ m, n ] = size ( p );

  if ( n ~= 3 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'polyiamond_triangle_print - Fatal error!\n' );
    fprintf ( 1, '  Input array P has column dimension %d, should be 3.\n', n );
    error ( 'polyiamond_triangle_print - Fatal error!' );
  end

  if ( m <= 0 )
    fprintf ( 1, '  [ Null array ]\n' );
  else
    for i = 1 : m
      fprintf ( 1, ' ' );
      for j = 1 : 3
        fprintf ( 1, ' %d', p(i,j) );
      end
      fprintf ( 1, '\n' );
    end
  end

  return
end
