function [ w, p ] = triangle_to_boundary ( t )

%*****************************************************************************80
%
%% triangle_to_boundary() converts a polyiamond description from triangle to boundary.
%
%  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).
%
%    The boundary word describes how to trace the boundary by starting
%    at a base point (i,j), and taking a sequence of steps of unit length 
%    in one of 6 directions, as suggested by this diagram:
%
%          5-----0-----*
%      ^  / \   / \   /
%     /  /   \ /   \ /
%    J  4-----P-----1
%      / \   / \   /
%     /   \ /   \ /
%    *-----3-----2
%
%          I-->
%
%    If the current position P has parallelogram coordinates (I,J), then
%    the step of given index moves to
%
%      0  (I,  J+1)
%      1  (I+1,J  )
%      2  (I+1,J-1)
%      3  (I,  J-1)
%      4  (I-1,J  )
%      5  (I-1,J+1)
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 October 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer T(TN,3), the IJK parallelogram triangle coordinates of the 
%    triangles making up the polyiamond. 
%
%  Output:
%
%    string W: the boundary word.
%
%    integer P(2): the boundary word starting point.
%
  e = triangle_to_edge ( t );
  [ w, p ] = edge_to_boundary ( e );

  return
end

