@@ -179,7 +179,22 @@ public void testNonSimple() throws IOException {
179179 TestCase .assertFalse (
180180 ShamosHoey .simplePolygon (new Polygon (new LineString (points ))));
181181 TestCase .assertFalse ((new LineString (points )).isSimple ());
182- TestCase .assertFalse ((new Polygon (new LineString (points ))).isSimple ());
182+ complex (new Polygon (new LineString (points )));
183+ TestCase .assertEquals (4 , points .size ());
184+
185+ points .clear ();
186+
187+ addPoint (points , 1 , 0 );
188+ addPoint (points , 0 , 1 );
189+ addPoint (points , 1 , 0 );
190+ addPoint (points , 2 , 2 );
191+
192+ TestCase .assertFalse (ShamosHoey .simplePolygonPoints (points ));
193+ TestCase .assertFalse (ShamosHoey .simplePolygon (new LineString (points )));
194+ TestCase .assertFalse (
195+ ShamosHoey .simplePolygon (new Polygon (new LineString (points ))));
196+ TestCase .assertFalse ((new LineString (points )).isSimple ());
197+ complex (new Polygon (new LineString (points )));
183198 TestCase .assertEquals (4 , points .size ());
184199
185200 }
@@ -828,6 +843,12 @@ private void validate(Polygon polygon, boolean simple) {
828843 Polygon copy = new Polygon (polygon );
829844 List <Point > points = copy .getRing (0 ).getPoints ();
830845
846+ Point first = points .get (0 );
847+ Point last = points .get (points .size () - 1 );
848+ if (first .equalsXY (last )) {
849+ points .remove (points .size () - 1 );
850+ }
851+
831852 for (int i = 1 ; i < points .size (); i ++) {
832853
833854 points .add (points .remove (0 ));
0 commit comments