function v = edge_to_vertex ( e )

%*****************************************************************************80
%
%% edge_to_vertex() converts a polyiamond from edge list to vertex list.
%
%  Discussion:
%
%    The edge list contains the sequence of parallelogram IJ coordinates
%    of the nodes that lie on the boundary of the polyiamond, listed
%    in counterclockwise order.
%
%    The vertex list of a polyiamond gives the IJ coordinates of the
%    polygonal vertices, in counterclockwise order.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 October 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer E(EN,2), the IJ parallelogram point coordinates of the
%    nodes that lie on the boundary of the polyiamond.
%
%  Output:
%
%    integer V(VN,2), the IJ parallelogram point coordinates of the 
%    vertices bounding the polyiamond. 
%
  en = size ( e, 1 );
  
  vn = 0;
  v = zeros ( vn, 2 );
%
%  Have to use WHILE rather than FOR, because we change EN.
%
  k = 1;
  while ( k <= en )

    km1 = i4_wrap ( k - 1, 1, en );
    kp1 = i4_wrap ( k + 1, 1, en );

    if ( nodes_are_collinear ( e(km1,1:2), e(k,1:2), e(kp1,1:2) ) )
      e = [ e(1:km1,1:2); e(kp1:en,1:2) ];
      en = en - 1;
    else
      v = [ v; e(k,1:2) ];
      k = k + 1;
    end

  end

  return
end

