Apache Lucene open-source search software
LUCENE-7967: Within check for GeoDegeneratePoint did not allow precision allowance.
Karl Wrightb8d48fa7a623
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePoint.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePoint.javaindex 572d00af9e7..fe9ac7921a7 100644--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePoint.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePoint.java@@ -125,7 +125,7 @@ class GeoDegeneratePoint extends GeoPoint implements GeoPointShape {@Overridepublic boolean isWithin(final double x, final double y, final double z) {- return x == this.x && y == this.y && z == this.z;+ return this.isIdentical(x, y, z);}@Overridediff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.javaindex 2589a19b661..cab8e064cd3 100644--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java@@ -24,6 +24,7 @@ import java.util.List;import org.junit.Test;import static org.junit.Assert.assertEquals;+import static org.junit.Assert.assertTrue;/*** Check relationship between polygon and GeoShapes of basic polygons. Normally we construct@@ -736,6 +737,14 @@ public class SimpleGeoPolygonRelationshipsTest {assertEquals(GeoArea.CONTAINS, rel);}+ @Test+ public void testDegeneratedPointInPole(){+ GeoBBox bBox1 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI*0.5, Math.PI*0.5, 0, 0);+ GeoPoint point = new GeoPoint(PlanetModel.SPHERE, Math.PI*0.5, Math.PI);+ System.out.println("bbox1 = "+bBox1+"; point = "+point);+ assertTrue(bBox1.isWithin(point));+ }+@Testpublic void testDegeneratePathShape(){GeoPoint point1 = new GeoPoint(PlanetModel.SPHERE, 0, 0);