function hexagon_triangle_plot_test ( )

%*****************************************************************************80
%
%% hexagon_triangle_plot_test() tests hexagon_triangle_plot.
%
%  Discussion:
%
%    The function plots some triangle in an Eternity hexagon.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 April 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'hexagon_triangle_plot_test():\n' );
  fprintf ( 1, '  hexagon_triangle_plot() plots some triangles in an Eternity hexagon.\n' );

  node_draw = false;

  figure ( );
  clf ( );
  hold ( 'on' );
%
%  Retrieve hexagon edge coordinates.
%
  e = hexagon_edge_xy ( );
%
%  Retrieve node coordinates.
%
  w = hexagon_node_xy ( );
%
%  Retrieve the indices of the nodes making up each triangle.
%
  [ wi, tt ] = hexagon_triangle_k ( );
%
%  Draw some triangles within the hexagon.
%
  dn = 36;
  d = ksub_random2 ( 36, dn );
  for i = 1 : dn
    k = d(i);
    a = wi(k,1);
    b = wi(k,2);
    c = wi(k,3);
    x = [ w(a,1), w(b,1), w(c,1) ];
    y = [ w(a,2), w(b,2), w(c,2) ];
    col = type_to_color ( tt(d(i)) );
    rgb = color_rgb ( col );
    fill ( x, y, rgb );
    xc = ( w(a,1) + w(b,1) + w(c,1) ) / 3.0;
    yc = ( w(a,2) + w(b,2) + w(c,2) ) / 3.0;
%   lc = sprintf ( '%d', k );
    lc = sprintf ( '%d', tt(d(i)) );
    text ( xc, yc, lc, 'HorizontalAlignment', 'Center' );
  end
%
%  Draw edges connected pairwise.
%
  en = size ( e, 1 );
  for ei = 1 : 2 : en
    for ej = ei + 2 : 2 : en
      plot ( [ e(ei,1), e(ej,1)], [ e(ei,2), e(ej,2) ], 'b-', 'linewidth', 1 );
    end
  end

  for ei = 2 : 2 : en
    for ej = ei + 6 : 6 : en
      plot ( [ e(ei,1), e(ej,1)], [ e(ei,2), e(ej,2) ], 'b-', 'linewidth', 1 );
    end
  end
%
%  Draw nodes.
%
  if ( node_draw )

    wn = size ( w, 1 );
    plot ( w(:,1), w(:,2), 'wo', ...
      'markersize', 25, ...
      'markeredgecolor', 'k', ...
      'markerfacecolor', 'w' );
%
%  Label nodes.
%
    node_label = 'ABCDEFGHIJKLMNOPQRSTUVWXZ';
    for i = 1 : 25
      text ( w(i,1), w(i,2), node_label(i), 'HorizontalAlignment', 'Center' );
    end

  end
%
%  Finish the plot.
%
  hold ( 'off' );
  grid ( 'on' );
  axis ( 'equal' );
  axis ( [ -1.10, +1.10, -0.95, +0.95 ] );
  title ( '' );
% title ( 'hexagon triangle plot' );
 
  filename = 'hexagon_triangle_plot.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'hexagon_triangle_plot_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

