function p2 = ij_reflect ( p, r )

%*****************************************************************************80
%
%% ij_reflect() reflects (i,j) coordinates.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 November 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer P(2): the IJ parallelogram coordinates of a point.
%
%    integer R: the reflection option.
%    0: no reflection;
%    1: reflect about the I axis;
%    2: reflect about the J axis;
%    3: reflect about both I and J axes.
%
%  Output:
%
%    integer P2(2): the IJ parallelogram coordinates of the reflected point.
%
  p2 = p;

  if ( r == 1 )
    p2(1) = - p2(1) - p2(2);
  elseif ( r == 2 )
    p2(1) =   p2(1) + p2(2);
    p2(2) = - p2(2);
  elseif ( r == 3 )
    p2(1) = - p2(1);
    p2(2) = - p2(2);
  end

  return
end

