function [ imin, imax, jmin, jmax ] = triangle_range ( t )

%*****************************************************************************80
%
%% triangle_range() determines the range of a polyiamond from its triangle list.
%
%  Discussion:
%
%    The triangle list is a list of the IJK parallelogram triangles
%    that constitute the polyiamond.
%    If k = 0, the "ijk" triangle has vertices
%      (i-1,j-1), (i,j-1), (i-1,j).
%    If k = 1, the "ijk" triangle has vertices
%      (i,j), (i-1,j), (i,j-1).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 October 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer T(TN,3): the list of triangles that form the polyiamond.
%
%  Output:
%
%    integer IMIN, IMAX, JMIN, JMAX: the I and J ranges of the polyiamond.
%
  tn = size ( t, 1 );

  imin =   Inf;
  imax = - Inf;
  jmin =   Inf;
  jmax = - Inf;

  for ti = 1 : tn
    ij = ijk_to_ij ( t(ti,1:3) );
    for ijk = 1 : 3
      i = ij(ijk,1);
      j = ij(ijk,2);
      imin = min ( imin, i );
      imax = max ( imax, i );
      jmin = min ( jmin, j );
      jmax = max ( jmax, j );
    end
  end

  return
end

