LUCENE-7967: Within check for GeoDegeneratePoint did not allow precision allowance.

This commit is contained in:
Karl Wright 2017-09-12 08:34:39 -04:00
parent fe34e141ca
commit b8d48fa7a6
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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);