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.java index 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 { @Override public 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); } @Override diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java index 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)); + } + @Test public void testDegeneratePathShape(){ GeoPoint point1 = new GeoPoint(PlanetModel.SPHERE, 0, 0);