LUCENE-7192: Catch the case where we have two points in the same poly that are not adjacent but identical.

This commit is contained in:
Karl Wright 2016-04-19 09:09:40 -04:00
parent 46062fbd86
commit 02f1dacc3d
1 changed files with 68 additions and 63 deletions

View File

@ -229,9 +229,13 @@ public class GeoPolygonFactory {
// Check if the extension of currentPath to considerPointIndex is workable
final GeoPoint considerStartPoint = currentPath.lastPoint;
final GeoPoint considerEndPoint = points.get(considerPointIndex);
final int nextPointIndex = getLegalIndex(considerPointIndex + 1, points.size());
if (!considerStartPoint.isNumericallyIdentical(considerEndPoint)) {
// Create a plane including these two
final Plane considerPlane = new Plane(considerStartPoint, considerEndPoint);
boolean isChoiceLegal = true;
//System.err.println(" considering "+considerStartPoint+" to "+considerEndPoint);
if (isChoiceLegal) {
// Consider the previous plane/point
@ -281,8 +285,6 @@ public class GeoPolygonFactory {
}
}
final int nextPointIndex = getLegalIndex(considerPointIndex + 1, points.size());
if (isChoiceLegal) {
// Extend the path and call ourselves recursively.
if (considerPointIndex == startPointIndex) {
@ -296,6 +298,9 @@ public class GeoPolygonFactory {
return result;
}
}
}
if (considerPointIndex == startPointIndex) {
break;
}