function rxy = rectangle_nodes ( nx, ny )

%*****************************************************************************80
%
%% rectangle_nodes() returns the coordinates of an NX by NY rectangle.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 December 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer NX, the width of the grid.
%
%    integer NY, the height of the grid.
%
%  Output:
%
%    integer RXY(RXYN,2): the coordinates of the nodes.
%
  rxyn = ( nx + 1 ) * ( ny + 1 ) + nx * ny;

  y1 = ( 0 : ny )';
  y2 = ( ( 0 : ( ny - 1 ) ) + 0.5 )';

  rxy = zeros ( 0, 2 );
  for xi = 0 : 2 * nx
    if ( mod ( xi, 2 ) == 0 )
      x1 = 0.5 * xi * ones ( ny + 1, 1 );
      rxy = [ rxy; x1, y1 ];
    else 
      x2 = 0.5 * xi * ones ( ny, 1 );
      rxy = [ rxy; x2, y2 ];
    end
  end

  return
end

