function boundary_snap_test ( )

%*****************************************************************************80
%
%% boundary_snap_test() tests boundary_snap().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 November 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'boundary_snap_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  boundary_snap() snaps a polyiamond so that it has\n' );
  fprintf ( 1, '  minimum I and J node coordinates of 0.\n' );

  [ w, p ] = boundary_tiny ( );

  d = [ 4, 3 ];
  [ w2, p2 ] = boundary_translate ( w, p, d );

  [ w3, p3 ] = boundary_snap ( w2, p2 );

  clf ( );
  hold ( 'on' );
%
%  Draw the parallelogram grid.
%
  v = boundary_to_vertex ( w2, p2 );
  iv = v(:,1);
  jv = v(:,2);
  imin = 0;
  imax = max ( iv ) + 1;
  jmin = 0;
  jmax = max ( jv + 1 );
  r = 0.85;
  color_back = 'cyan';
  color_tri =  'yellow';
  number = false;
  grid_plot ( imin, imax, jmin, jmax, r, color_back, color_tri, number );
%
%  Draw the polyiamonds.
%
  color = 'cyan';
  number = true;
  boundary_plot ( w2, p2, color, number );

  color = 'red';
  number = true;
  boundary_plot ( w3, p3, color, number );

  axis ( 'equal' );
  axis ( 'off' );
  title ( 'boundary snap: cyan snapped to red' )
  hold ( 'off' );

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

  return
end

