function t = boundary_to_triangle ( w, p )

%*****************************************************************************80
%
%% boundary_to_triangle() converts a polyiamond description from boundary to triangle.
%
%  Discussion:
%
%    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)
%
%    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:
%
%    22 October 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string W: the boundary word.
%
%    integer P(2): the boundary word starting point.
%
%  Output:
%
%    integer T(TN,3): the IJK parallelogram coordinates of the 
%    triangles forming the polyiamond.  
%
  v = boundary_to_vertex ( w, p );
  t = vertex_to_triangle ( v );

  return
end

