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 2022/11/25 12:41:20 UTC

[lucene] branch GITHUB-11883 created (now b5f94b67546)

This is an automated email from the ASF dual-hosted git repository.

kwright pushed a change to branch GITHUB-11883
in repository https://gitbox.apache.org/repos/asf/lucene.git


      at b5f94b67546 Add test that tweaks identical planes in intersections bug

This branch includes the following new commits:

     new b5f94b67546 Add test that tweaks identical planes in intersections bug

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[lucene] 01/01: Add test that tweaks identical planes in intersections bug

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwright pushed a commit to branch GITHUB-11883
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit b5f94b67546bbb55abb1ee0d34b1e2cc927c6fcb
Author: Karl David Wright <kw...@apache.org>
AuthorDate: Fri Nov 25 07:40:45 2022 -0500

    Add test that tweaks identical planes in intersections bug
---
 .../lucene/spatial3d/geom/TestGeoPolygon.java      | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoPolygon.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoPolygon.java
index 8e0dd8101f6..6377bfd1f61 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoPolygon.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoPolygon.java
@@ -25,6 +25,38 @@ import org.junit.Test;
 
 public class TestGeoPolygon extends LuceneTestCase {
 
+  @Test
+  public void testH3CellsWrongIntersection() {
+    final List<GeoPoint> points1 = new ArrayList<>();
+    addToList(points1, PlanetModel.SPHERE, -64.2102198418716, -39.14233318389477);
+    addToList(points1, PlanetModel.SPHERE, -64.21016450005413, -39.142267144439614);
+    addToList(points1, PlanetModel.SPHERE, -64.21021077465937, -39.1421844504783);
+    addToList(points1, PlanetModel.SPHERE, -64.21031239098929, -39.142167795785085);
+    addToList(points1, PlanetModel.SPHERE, -64.2103677330169, -39.14223383513698);
+    addToList(points1, PlanetModel.SPHERE, -64.21032145850448, -39.14231652928534);
+    final List<GeoPoint> points2 = new ArrayList<>();
+    addToList(points2, PlanetModel.SPHERE, -64.20991499254879, -39.14238314705201);
+    addToList(points2, PlanetModel.SPHERE, -64.20985965132967, -39.14231710755475);
+    addToList(points2, PlanetModel.SPHERE, -64.20990592624541, -39.142234413886875);
+    addToList(points2, PlanetModel.SPHERE, -64.21000754228744, -39.142217759529174);
+    addToList(points2, PlanetModel.SPHERE, -64.21006288371667, -39.14228379892317);
+    addToList(points2, PlanetModel.SPHERE, -64.21001660889377, -39.14236649277811);
+   
+    final GeoPolygon polygon1 = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points1);
+    final GeoPolygon polygon2 = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points2);
+    // System.out.println("Polygon1 = "+polygon1);
+    // System.out.println("Polygon2 = "+polygon2);
+    assertFalse(polygon1.intersects(polygon2));
+  }
+
+  private static void addToList(List<GeoPoint> points, PlanetModel planetModel, double lon, double lat) {
+    points.add(
+               new GeoPoint(
+                            planetModel,
+                            Geo3DUtil.fromDegrees(lat),
+                            Geo3DUtil.fromDegrees(lon)));
+  }
+  
   @Test
   public void testPolygonPointFiltering() {
     final GeoPoint point1 = new GeoPoint(PlanetModel.WGS84, 1.0, 2.0);