lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject lucene-solr:branch_7x: LUCENE-8133: Increase MINIMUM_RESOLUTION to 1.5e-12.
Date Tue, 23 Jan 2018 12:37:38 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x e785dd7f2 -> 922188185


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/92218818
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/92218818
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/92218818

Branch: refs/heads/branch_7x
Commit: 922188185e125c43328b3704d06acc6a6619e976
Parents: e785dd7
Author: Karl Wright <DaddyWri@gmail.com>
Authored: Tue Jan 23 07:34:49 2018 -0500
Committer: Karl Wright <DaddyWri@gmail.com>
Committed: Tue Jan 23 07:37:30 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/92218818/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/92218818/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/92218818/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);
+  }
+
+
 }


Mime
View raw message