function h = object_hexity ( w, p )

%*****************************************************************************80
%
%% object_hexity() returns the hex parity of an Eternity object.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 February 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    character string W: the boundary word of the object.
%
%    integer P(1,2): the base point of the object.
%
%  Output:
%
%    integer H(1,12): the hex parity of the object.
%

%
%  Make space.
%
  h = zeros ( 1, 12 );
%
%  TT is the `type' of each element triangle.
%  Clockwise, these are 1, 2, 3, 4, 5, 6, -6, -5, -4, -3, -2, -1.
%
  [ tk, tt, tw ] = triangle_k ( w, p );
%
%  Count the elements.
%
  element_num = size ( tt, 1 );
%
%  Store counts as (1,2,3,4,5,6,-6,-5,-4,-3,-2,-1)
%
  for e = 1 : element_num
    if ( tt(e) < 0 )
      i = 12 + 1 + tt(e);
    else
      i = tt(e);
    end
    h(1,i) = h(1,i) + 1;
  end

  return
end

