You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2018/01/23 12:36:42 UTC
lucene-solr:branch_6x: LUCENE-8133: Increase MINIMUM_RESOLUTION to
1.5e-12.
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x b190877d5 -> 8fb6e8307
LUCENE-8133: Increase MINIMUM_RESOLUTION to 1.5e-12.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8fb6e830
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8fb6e830
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8fb6e830
Branch: refs/heads/branch_6x
Commit: 8fb6e8307a21220b2d7c40680d02fed52d02dec0
Parents: b190877
Author: Karl Wright <Da...@gmail.com>
Authored: Tue Jan 23 07:34:49 2018 -0500
Committer: Karl Wright <Da...@gmail.com>
Committed: Tue Jan 23 07:36:33 2018 -0500
----------------------------------------------------------------------
.../lucene/spatial3d/geom/SidedPlane.java | 1 +
.../apache/lucene/spatial3d/geom/Vector.java | 2 +-
.../lucene/spatial3d/geom/GeoPolygonTest.java | 21 +++++++++++++++++++-
3 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8fb6e830/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java
----------------------------------------------------------------------
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.java
index 8319e6f..404135a 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 {
@Override
public 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);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8fb6e830/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java
----------------------------------------------------------------------
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.java
index 852cac4..8fad521 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.
*/
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8fb6e830/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 00d7899..8892111 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);
+ }
+
+
}