lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [38/50] lucene-solr:jira/solr-12181: LUCENE-8245: Adjust envelope to not leave as big a gap between travel planes and above/below planes.
Date Tue, 10 Apr 2018 14:12:17 GMT
LUCENE-8245: Adjust envelope to not leave as big a gap between travel planes and above/below
planes.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/348de9e8
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/348de9e8
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/348de9e8

Branch: refs/heads/jira/solr-12181
Commit: 348de9e8b59d1ba6cf37999fe4c11c8365147fdd
Parents: aba793d
Author: Karl Wright <DaddyWri@gmail.com>
Authored: Sun Apr 8 06:44:10 2018 -0400
Committer: Karl Wright <DaddyWri@gmail.com>
Committed: Sun Apr 8 06:44:10 2018 -0400

----------------------------------------------------------------------
 .../org/apache/lucene/spatial3d/geom/Plane.java |  2 +-
 .../lucene/spatial3d/geom/GeoPolygonTest.java   | 32 ++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/348de9e8/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
index fe3418c..34a2fce 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
@@ -24,7 +24,7 @@ package org.apache.lucene.spatial3d.geom;
  */
 public class Plane extends Vector {
   /** For plane envelopes, we need a small distance that can't lead to numerical confusion.
*/
-  public final static double MINIMUM_PLANE_OFFSET = MINIMUM_RESOLUTION * 1.5;
+  public final static double MINIMUM_PLANE_OFFSET = MINIMUM_RESOLUTION * 1.1;
   /** An array with no points in it */
   public final static GeoPoint[] NO_POINTS = new GeoPoint[0];
   /** An array with no bounds in it */

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/348de9e8/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 581112d..d1e6688 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
@@ -1469,5 +1469,37 @@ shape:
     final GeoPoint point3 = new GeoPoint(PlanetModel.SPHERE, 0, 1e-6);
     assertTrue(polygon.isWithin(point3) == largePolygon.isWithin(point3));
   }
+
+  @Test
+  public void testAboveBelowCrossingDifferentEdges() {
+    //POLYGON((130.846821906638 -5.066128831305991,134.5635278421427 21.75703481126756,156.31803093908155
44.5755831677161,0.0 8.860146581178396E-33,130.846821906638 -5.066128831305991))
+    final List<GeoPoint> points = new ArrayList<>();
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-5.066128831305991),
Geo3DUtil.fromDegrees(130.846821906638)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(21.75703481126756),
Geo3DUtil.fromDegrees(134.5635278421427)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(44.5755831677161),
Geo3DUtil.fromDegrees(156.31803093908155)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(8.860146581178396E-33),
Geo3DUtil.fromDegrees(0.0)));
+    final GeoPolygonFactory.PolygonDescription description = new GeoPolygonFactory.PolygonDescription(points);
+    final GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, description);
+    final GeoPolygon largePolygon = GeoPolygonFactory.makeLargeGeoPolygon(PlanetModel.SPHERE,
Collections.singletonList(description));
+    //POINT(-15.37308034708334 1.3353777223310798E-11)
+    final GeoPoint point1 = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(1.3353777223310798E-11),
Geo3DUtil.fromDegrees(-15.37308034708334));
+    assertTrue(polygon.isWithin(point1) == largePolygon.isWithin(point1));
+  }
+
+  @Test
+  public void testBelowCrossingTwiceEdgePoint() {
+    //POLYGON((162.9024012378976 -0.17652184258966092,162.56882659034474 -0.009075185910497524,162.52932263918404
1.6235907240799453E-189,162.17731099253956 -0.2154890860855618,162.9024012378976 -0.17652184258966092))
+    List<GeoPoint> points = new ArrayList<>();
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-0.17652184258966092),
Geo3DUtil.fromDegrees(162.9024012378976)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-0.009075185910497524),
Geo3DUtil.fromDegrees(162.56882659034474)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(1.6235907240799453E-189),
Geo3DUtil.fromDegrees(162.52932263918404)));
+    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-0.2154890860855618),
Geo3DUtil.fromDegrees(162.17731099253956)));
+    final GeoPolygonFactory.PolygonDescription description = new GeoPolygonFactory.PolygonDescription(points);
+    final GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, description);
+    final GeoPolygon largePolygon = GeoPolygonFactory.makeLargeGeoPolygon(PlanetModel.SPHERE,
Collections.singletonList(description));
+    //POINT(91.60559215160585 -6.782152464351765E-11)
+    final GeoPoint point = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-6.782152464351765E-11),
Geo3DUtil.fromDegrees(91.60559215160585));
+    assertTrue(polygon.isWithin(point) == largePolygon.isWithin(point));
+  }
   
 }


Mime
View raw message