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:40 UTC
lucene-solr:branch_6x: LUCENE-8444: Prevent building functionally
identical plane bounds when constructing DualCrossingEdgeIterator
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 28d92bebf -> 4f940793d
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/4f940793
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/4f940793
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/4f940793
Branch: refs/heads/branch_6x
Commit: 4f940793d7447f287074f98490dc6de7042aa8bf
Parents: 28d92be
Author: Ignacio Vera <iv...@apache.org>
Authored: Mon Aug 6 12:43:19 2018 +0200
Committer: Ignacio Vera <iv...@apache.org>
Committed: Mon Aug 6 12:43: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/4f940793/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index b9343b6..9d7dba0 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -46,6 +46,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-8266: Detect bogus tiles when creating a standard polygon
and throw a TileException. (Ignacio Vera)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4f940793/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 580338d..a7c55dd 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/4f940793/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<>();