You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/09/02 15:42:35 UTC

[04/50] lucene-solr:feature/autoscaling: LUCENE-7941: Test for GeoDegeneratePoints relationships, committed on behalf of Ignacio Vera.

LUCENE-7941: Test for GeoDegeneratePoints relationships, committed on behalf of Ignacio Vera.


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

Branch: refs/heads/feature/autoscaling
Commit: 72818637f28a962843faa113e0fd6d1de8b25869
Parents: 869fc53
Author: Karl Wright <Da...@gmail.com>
Authored: Mon Aug 28 06:08:53 2017 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Mon Aug 28 06:08:53 2017 -0400

----------------------------------------------------------------------
 .../geom/SimpleGeoPolygonRelationshipsTest.java       | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/72818637/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java
index 973483e..06aa8b9 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/SimpleGeoPolygonRelationshipsTest.java
@@ -722,6 +722,20 @@ public class SimpleGeoPolygonRelationshipsTest {
     assertEquals(GeoArea.OVERLAPS,  rel);
   }
 
+  @Test
+  public void testDegeneratedPointIntersectShape(){
+    GeoBBox bBox1 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 1,0,0,1);
+    GeoBBox bBox2 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 1,1,1,1);
+    int rel = bBox1.getRelationship(bBox2);
+    //OVERLAPS instead of WITHIN. In this case the degenerated point lies on the edge of the shape.
+    //intersects() returns true for one plane of the BBox and hence method return OVERLAPS.
+    assertEquals(GeoArea.OVERLAPS,  rel);
+    rel = bBox2.getRelationship(bBox1);
+    // The degenerated point cannot compute if it is on the edge. Uses WITHIN that is true
+    // and therefore CONTAINS
+    assertEquals(GeoArea.CONTAINS,  rel);
+  }
+
   private GeoPolygon buildConvexGeoPolygon(double lon1, double lat1,
                                            double lon2, double lat2,
                                            double lon3, double lat3,