function triangle_refine ( c )

%*****************************************************************************80
%
%% triangle_refine() prints the vertex weights of a refined triangle.
%
%  Discussion:
%
%    These vertex weights are not normalized.  They need to be divided
%    by C to be interpreted as barycentric coordinates.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 March 2023
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer C: the number of refinements.
%
  for i = c : -1 : 1
    for j = c - i : -1 : 0
      k = c - j - i;
      fprintf ( 1, '\n' )
      fprintf ( 1, '  %2d  %2d  %2d\n', i,   j,   k )
      fprintf ( 1, '  %2d  %2d  %2d\n', i-1, j+1, k )
      fprintf ( 1, '  %2d  %2d  %2d\n', i-1, j,   k+1 )
    end
  end

  for i = c : -1 : 1
    for j = c - i : -1 : 1
      k = c - j - i;
      fprintf ( 1, '\n' )
      fprintf ( 1, '  %2d  %2d  %2d\n', i,   j,   k )
      fprintf ( 1, '  %2d  %2d  %2d\n', i-1, j,   k+1 )
      fprintf ( 1, '  %2d  %2d  %2d\n', i  , j-1, k+1 )
    end
  end

  return
end
        
