Apache Lucene open-source search software
LUCENE-8133: Increase MINIMUM_RESOLUTION to 1.5e-12.
Karl Wrighta7a28ec170a0
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.javaindex 8319e6fe2d0..404135aaa49 100755--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java@@ -190,6 +190,7 @@ public class SidedPlane extends Plane implements Membership {@Overridepublic boolean isWithin(double x, double y, double z) {double evalResult = evaluate(x, y, z);+ //System.out.println(Math.abs(evalResult));if (Math.abs(evalResult) < MINIMUM_RESOLUTION)return true;double sigNum = Math.signum(evalResult);diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.javaindex 852cac49df1..8fad521fea9 100755--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java@@ -27,7 +27,7 @@ public class Vector {* Values that are all considered to be essentially zero have a magnitude* less than this.*/- public static final double MINIMUM_RESOLUTION = 1.0e-12;+ public static final double MINIMUM_RESOLUTION = 1.5e-12;/*** Angular version of minimum resolution.*/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.javaindex 00d789993ca..88921117158 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@@ -1029,5 +1029,24 @@ shape:GeoPolygon polygon2 = GeoPolygonFactory.makeGeoConvexPolygon(PlanetModel.SPHERE,points,Collections.singletonList(hole));assertEquals(polygon,polygon2);}-++ @Test+ public void testLUCENE8133() {+ GeoPoint point1 = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434456), Geo3DUtil.fromDegrees(14.459204));+ GeoPoint point2 = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.43394), Geo3DUtil.fromDegrees(14.459206));+ GeoPoint check = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434067), Geo3DUtil.fromDegrees(14.458927));+ SidedPlane plane = new SidedPlane(check, point1, point2);+ assertTrue(plane.isWithin(check));+ assertTrue(plane.isWithin(point1));+ assertTrue(plane.isWithin(point2));+ //POLYGON((14.459204 -23.434456, 14.459206 -23.43394,14.458647 -23.434196, 14.458646 -23.434452,14.459204 -23.434456))+ List<GeoPoint> points = new ArrayList<>();+ points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434456), Geo3DUtil.fromDegrees(14.459204)));+ points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees( -23.43394), Geo3DUtil.fromDegrees(14.459206)));+ points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434196), Geo3DUtil.fromDegrees(14.458647)));+ points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434452), Geo3DUtil.fromDegrees(14.458646)));+ GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points);+ }++}