function edge_snap_test ( )

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

  e = edge_tiny ( );

  d = [ 2, -3 ];
  e2 = edge_translate ( e, d );

  e3 = edge_snap ( e2 );
%
%  Get the plot range.
%
  [ imin2, imax2, jmin2, jmax2 ] = edge_range ( e2 );
  [ imin3, imax3, jmin3, jmax3 ] = edge_range ( e3 );

  imin = min ( [ 0, imin2, imin3 ] );
  imax = max ( [ 0, imax2, imax3 ] ) + 1;
  jmin = min ( [ 0, jmin2, jmin3 ] );
  jmax = max ( [ 0, jmax2, jmax3 ] ) + 1;
%
%  Draw the parallelogram grid.
%
  clf ( );
  hold ( 'on' );
  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;
  edge_plot ( e2, color, number );

  color = 'red';
  number = true;
  edge_plot ( e3, color, number );

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

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

  return
end

