function value = quad_is_simple ( xy )
%*****************************************************************************80
%
%% QUAD_IS_SIMPLE determines whether a quadrilateral is simple.
%
% Discussion:
%
% A simple quadrilateral is one that is non-degenerate.
%
% Visually speaking, a degenerate quadrilateral is one in which
% one side crosses another; the shape looks twisted or folded.
% Angles and areas and centroids and similar quantities
% become difficult to define or compute for degenerate quadrilaterals.
%
% Licensing:
%
% This code is distributed under the GNU LGPL license.
%
% Modified:
%
% 01 August 2018
%
% Author:
%
% John Burkardt
%
% Input:
%
% real XY(2,4), the coordinates of the
% nodes of the quadrilateral, given in counterclockwise order.
%
% Output:
%
% logical VALUE, is TRUE if the quadrilateral is simple.
%
angles = quad_angles_degrees ( xy );
angle_sum = sum ( angles );
%
% A degenerate quadrilateral would typically have an angle sum of 720
% degrees, so this test could be loosened.
%
value = ( abs ( angle_sum - 360.0 ) < 1.0 );
return
end