You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2018/08/06 10:44:03 UTC

lucene-solr:branch_7x: LUCENE-8444: Prevent building functionally identical plane bounds when constructing DualCrossingEdgeIterator

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 3712b8fc2 -> 3918b7d0a


LUCENE-8444: Prevent building functionally identical plane bounds when constructing DualCrossingEdgeIterator


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/3918b7d0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/3918b7d0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/3918b7d0

Branch: refs/heads/branch_7x
Commit: 3918b7d0a9ee3897816000e1e36cea9c18a83cc2
Parents: 3712b8f
Author: Ignacio Vera <iv...@apache.org>
Authored: Mon Aug 6 12:41:19 2018 +0200
Committer: Ignacio Vera <iv...@apache.org>
Committed: Mon Aug 6 12:41:19 2018 +0200

----------------------------------------------------------------------
 lucene/CHANGES.txt                                |  3 +++
 .../lucene/spatial3d/geom/GeoComplexPolygon.java  |  8 ++++----
 .../lucene/spatial3d/geom/GeoPolygonTest.java     | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3918b7d0/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index b3208aa..ea81213 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -50,6 +50,9 @@ Bug Fixes:
 * LUCENE-8445: Tighten condition when two planes are identical to prevent constructing
   bogus tiles when building GeoPolygons. (Ignacio Vera)
 
+* LUCENE-8444: Prevent building functionally identical plane bounds when constructing
+  DualCrossingEdgeIterator . (Ignacio Vera)
+
 * LUCENE-8380: UTF8TaxonomyWriterCache inconsistency. (Ruslan Torobaev, Dawid Weiss)
 
 * LUCENE-8164: IndexWriter silently accepts broken payload. This has been fixed

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3918b7d0/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 b7a62d3..60acca5 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
@@ -1504,16 +1504,16 @@ class GeoComplexPolygon extends GeoBasePolygon {
       
       final SidedPlane testPointBound1 = new SidedPlane(intersectionPoint, testPointPlane, testPoint);
       final SidedPlane testPointBound2 = new SidedPlane(testPoint, testPointPlane, intersectionPoint);
-      if (testPointBound1.isNumericallyIdentical(testPointBound2)) {
-        throw new IllegalArgumentException("Dual iterator unreliable when bounds planes are numerically identical");
+      if (testPointBound1.isFunctionallyIdentical(testPointBound2)) {
+        throw new IllegalArgumentException("Dual iterator unreliable when bounds planes are functionally identical");
       }
       this.testPointCutoffPlane = testPointBound1;
       this.testPointOtherCutoffPlane = testPointBound2;
 
       final SidedPlane checkPointBound1 = new SidedPlane(intersectionPoint, travelPlane, thePointX, thePointY, thePointZ);
       final SidedPlane checkPointBound2 = new SidedPlane(thePointX, thePointY, thePointZ, travelPlane, intersectionPoint);
-      if (checkPointBound1.isNumericallyIdentical(checkPointBound2)) {
-        throw new IllegalArgumentException("Dual iterator unreliable when bounds planes are numerically identical");
+      if (checkPointBound1.isFunctionallyIdentical(checkPointBound2)) {
+        throw new IllegalArgumentException("Dual iterator unreliable when bounds planes are functionally identical");
       }
       this.checkPointCutoffPlane = checkPointBound1;
       this.checkPointOtherCutoffPlane = checkPointBound2;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3918b7d0/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 c8cbc1b..1aae820 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
@@ -1851,6 +1851,24 @@ shape:
   }
 
   @Test
+  public void testLUCENE8444() {
+    //POLYGON((0.0 -67.68132244526963,-1.2477695347678826E-95 -88.11137674490907, 1.7059188343238906E-9 7.009654350320916,0.0 -67.68132244526963))
+    final List<GeoPoint> points = new ArrayList<>();
+    points.add(new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(-67.68132244526963), Geo3DUtil.fromDegrees(0.0)));
+    points.add(new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(-88.11137674490907), Geo3DUtil.fromDegrees(-1.2477695347678826E-95)));
+    points.add(new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(7.009654350320916), Geo3DUtil.fromDegrees(1.7059188343238906E-9)));
+
+    final GeoPolygonFactory.PolygonDescription description = new GeoPolygonFactory.PolygonDescription(points);
+    final GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(PlanetModel.WGS84, description);
+    final GeoPolygon largePolygon = GeoPolygonFactory.makeLargeGeoPolygon(PlanetModel.WGS84, Collections.singletonList(description));
+
+    //POINT(180.0 -61.73229670194638)
+    final GeoPoint point = new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(-61.73229670194638), Geo3DUtil.fromDegrees(180.0));
+    //assertTrue(polygon.isWithin(point) == largePolygon.isWithin(point));
+    assertTrue(false == largePolygon.isWithin(point));
+  }
+
+  @Test
   public void testLUCENE8445() {
     //POLYGON((32.18017946378854 -17.397683785381247,49.51018758330871 -9.870219317504647,58.77903721991479 33.90553510354402,2.640604559432277 9.363173880050821,3.1673235739886286E-10 8.853669066894417E-11,0.0 -5.7E-322,4.820339742500488E-5 5.99784517213369E-7,32.18017946378854 -17.397683785381247))
     final List<GeoPoint> points = new ArrayList<>();