function polygon_is_ccw_test ()

%*****************************************************************************80
%
%% polygon_is_ccw_test() tests polygon_is_ccw().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 December 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'polygon_is_ccw_test():\n' );
  fprintf ( 1, '  polygon_is_cc2() determines if the vertices of a polygon\n' );
  fprintf ( 1, '  are listed in counter-clockwise order.\n' );

  a = [ 0.0, 0.0 ];
  b = [ 1.0, 0.0 ];
  c = [ 1.0, 1.0 ];
  d = [ 0.0, 1.0 ];
%
%  Try all six orientations of the the four vertices.
%  Only one (a,b,c,d) should be acceptable.
%
  for test = 1 : 6

    if ( test == 1 )
      v = [ a; b; c; d ];
    elseif ( test == 2 )
      v = [ a; b; d; c ];
    elseif ( test == 3 )
      v = [ a; c; b; d ];
    elseif ( test == 4 )
      v = [ a; c; d; b ];
    elseif ( test == 5 )
      v = [ a; d; b; c ];
    elseif ( test == 6 )
      v = [ a; d; c; b ];
    end

    fprintf ( 1, '\n' );
    fprintf ( 1, '  polygon vertices:\n' );
    disp ( v );

    value = polygon_is_ccw ( v );

    if ( value )
      fprintf ( 1, '  The polygon vertices are counter clockwise.\n' );
    else
      fprintf ( 1, '  The polygon vertices are NOT counter clockwise.\n' );
    end

  end

  return
end
