You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2018/04/05 17:58:21 UTC
lucene-solr:branch_6x: LUCENE-8239: Handle degenerate vector case on
linear edge evaluation.
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 585cf7512 -> db3a89ed4
LUCENE-8239: Handle degenerate vector case on linear edge evaluation.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/db3a89ed
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/db3a89ed
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/db3a89ed
Branch: refs/heads/branch_6x
Commit: db3a89ed4d4bfb6c8d641bcd5e30cbc307beded7
Parents: 585cf75
Author: Karl Wright <Da...@gmail.com>
Authored: Thu Apr 5 13:56:21 2018 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Thu Apr 5 13:58:14 2018 -0400
----------------------------------------------------------------------
.../apache/lucene/spatial3d/geom/GeoComplexPolygon.java | 11 ++++++++---
.../org/apache/lucene/spatial3d/geom/GeoPolygonTest.java | 1 -
2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/db3a89ed/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
index d11fb79..f64755c 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
@@ -195,7 +195,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
}
// If we're right on top of any of the test planes, we navigate solely on that plane.
- if (testPointFixedYPlane.evaluateIsZero(x, y, z)) {
+ if (testPointFixedYAbovePlane != null && testPointFixedYBelowPlane != null && testPointFixedYPlane.evaluateIsZero(x, y, z)) {
// Use the XZ plane exclusively.
final CountingEdgeIterator crossingEdgeIterator = createLinearCrossingEdgeIterator(testPointFixedYPlane, testPointFixedYAbovePlane, testPointFixedYBelowPlane, x, y, z);
// Traverse our way from the test point to the check point. Use the y tree because that's fixed.
@@ -204,7 +204,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
return true;
}
return ((crossingEdgeIterator.getCrossingCount() & 1) == 0)?testPointInSet:!testPointInSet;
- } else if (testPointFixedXPlane.evaluateIsZero(x, y, z)) {
+ } else if (testPointFixedXAbovePlane != null && testPointFixedXBelowPlane != null && testPointFixedXPlane.evaluateIsZero(x, y, z)) {
// Use the YZ plane exclusively.
final CountingEdgeIterator crossingEdgeIterator = createLinearCrossingEdgeIterator(testPointFixedXPlane, testPointFixedXAbovePlane, testPointFixedXBelowPlane, x, y, z);
// Traverse our way from the test point to the check point. Use the x tree because that's fixed.
@@ -213,7 +213,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
return true;
}
return ((crossingEdgeIterator.getCrossingCount() & 1) == 0)?testPointInSet:!testPointInSet;
- } else if (testPointFixedZPlane.evaluateIsZero(x, y, z)) {
+ } else if (testPointFixedZAbovePlane != null && testPointFixedZBelowPlane != null && testPointFixedZPlane.evaluateIsZero(x, y, z)) {
final CountingEdgeIterator crossingEdgeIterator = createLinearCrossingEdgeIterator(testPointFixedZPlane, testPointFixedZAbovePlane, testPointFixedZBelowPlane, x, y, z);
// Traverse our way from the test point to the check point. Use the z tree because that's fixed.
if (!zTree.traverse(crossingEdgeIterator, testPoint.z)) {
@@ -221,6 +221,8 @@ class GeoComplexPolygon extends GeoBasePolygon {
return true;
}
return ((crossingEdgeIterator.getCrossingCount() & 1) == 0)?testPointInSet:!testPointInSet;
+ } else if (testPointFixedYPlane.evaluateIsZero(x, y, z) || testPointFixedXPlane.evaluateIsZero(x, y, z) || testPointFixedZPlane.evaluateIsZero(x, y, z)) {
+ throw new IllegalArgumentException("Can't compute isWithin for specified point");
} else {
// This is the expensive part!!
@@ -903,6 +905,9 @@ class GeoComplexPolygon extends GeoBasePolygon {
this.plane = plane;
this.abovePlane = abovePlane;
this.belowPlane = belowPlane;
+ if (plane.isNumericallyIdentical(testPoint)) {
+ throw new IllegalArgumentException("Plane vector identical to testpoint vector");
+ }
// It doesn't matter which 1/2 of the world we choose, but we must choose only one.
this.bound = new SidedPlane(plane, testPoint);
this.thePointX = thePointX;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/db3a89ed/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
index b5c18cf..ee15ec4 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
@@ -1450,7 +1450,6 @@ shape:
assertTrue(polygon.isWithin(point1) == largePolygon.isWithin(point1));
}
- @Ignore
@Test
public void testComplexPolygonDegeneratedVector() {
List<GeoPoint> points = new ArrayList<>();