function vertex_snap_test ( )

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

  v = vertex_tiny ( );

  d = [ 2, -3 ];
  v2 = vertex_translate ( v, d );

  v3 = vertex_snap ( v2 );

  clf ( );
  hold ( 'on' );
%
%  Draw the parallelogram grid.
%
  imin = 0;
  imin = min ( imin, min ( v2(:,1) ) );
  imax = max ( max ( v2(:,1) ), max ( v3(:,1) ) ) + 1;

  jmin = 0;
  jmin = min ( jmin, min ( v2(:,2) ) );
  jmax = max ( max ( v2(:,2) ), max ( v3(:,2) ) ) + 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;
  vertex_plot ( v2, color, number );

  color = 'red';
  number = true;
  vertex_plot ( v3, color, number );

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

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

  return
end

