function boundary_reflect_test ( )

%*****************************************************************************80
%
%% boundary_reflect_test() tests boundary_reflect().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 June 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'boundary_reflect_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  boundary_reflect() is given a boundary word W and base\n' );
  fprintf ( 1, '  point P, and reflects about the 0, 60, or 120 degree axis.\n' );

  k = 4;
  [ w0, p0 ] = tetrahex_word ( k );
  boundary_print ( w0, p0, '  pistol' );
  r = 1;
  [ w1, p1 ] = boundary_reflect ( w0, p0, r );
  boundary_print ( w1, p1, '  pistol, 0 degree reflection' );
  r = 2;
  [ w2, p2 ] = boundary_reflect ( w0, p0, r );
  boundary_print ( w2, p2, '  pistol, 60 degree reflection' );
  r = 3;
  [ w3, p3 ] = boundary_reflect ( w0, p0, r );
  boundary_print ( w3, p3, '  pistol, 120 degree reflection' );
%
%  Get the plot range.
%
  [ imin0, imax0, jmin0, jmax0 ] = boundary_range ( w0, p0 );
  [ imin1, imax1, jmin1, jmax1 ] = boundary_range ( w1, p1 );
  [ imin2, imax2, jmin2, jmax2 ] = boundary_range ( w2, p2 );
  [ imin3, imax3, jmin3, jmax3 ] = boundary_range ( w3, p3 );

  imin = min ( [ 0, imin0, imin1, imin2, imin3 ] );
  imax = max ( [ 0, imax0, imax1, imax2, imax3 ] ) + 1;
  jmin = min ( [ 0, jmin0, jmin1, jmin2, jmin3 ] );
  jmax = max ( [ 0, jmax0, jmax1, jmax2, jmax3 ] ) + 1;
%
%  Draw the grid.
%
  clf ( );
  hold ( 'on' );
  r = 0.85;
  color_back = 'cyan';
  color_tri =  'white';
  number = false;
  grid_plot ( imin, imax, jmin, jmax, r, color_back, color_tri, number );
%
%  Draw the polyiamonds.
%
  color = 'cyan';
  number = false;
% boundary_plot ( w0, p0, color, number );

  color = 'magenta';
  number = false;
  boundary_plot ( w1, p1, color, number );

  color = 'yellow';
  number = false;
  boundary_plot ( w2, p2, color, number );

  color = 'blue';
  number = false;
  boundary_plot ( w3, p3, color, number );

  axis ( 'equal' );
  axis ( 'off' );
  title ( 'boundary reflect test' )
  hold ( 'off' );

  filename = 'boundary_reflect_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'boundary_reflect_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

