You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2018/04/05 13:35:57 UTC
lucene-solr:master: LUCENE-8239: Add failing test with ignore flag
Repository: lucene-solr
Updated Branches:
refs/heads/master 4a902f35d -> 508476e1a
LUCENE-8239: Add failing test with ignore flag
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/508476e1
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/508476e1
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/508476e1
Branch: refs/heads/master
Commit: 508476e1ad304598433acac71cac47ed92332ad5
Parents: 4a902f3
Author: Ignacio Vera <iv...@apache.org>
Authored: Thu Apr 5 15:33:55 2018 +0200
Committer: Ignacio Vera <iv...@apache.org>
Committed: Thu Apr 5 15:33:55 2018 +0200
----------------------------------------------------------------------
.../lucene/spatial3d/geom/GeoPolygonTest.java | 45 ++++++++++++++++++++
1 file changed, 45 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/508476e1/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 f577901..fb32471 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
@@ -21,6 +21,7 @@ import java.util.List;
import java.util.BitSet;
import java.util.Collections;
+import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -1427,5 +1428,49 @@ shape:
int largeIntersection = solid.getRelationship(largeShape);
assertTrue(intersection == largeIntersection);
}
+
+ @Ignore
+ @Test
+ public void testComplexPolygonPlaneOutsideWorld() {
+ List<GeoPoint> points = new ArrayList<>();
+ points.add(new GeoPoint(PlanetModel.SPHERE, -0.5, -0.5));
+ points.add(new GeoPoint(PlanetModel.SPHERE, -0.5, 0.5));
+ points.add(new GeoPoint(PlanetModel.SPHERE, 0.5, 0.5));
+ points.add(new GeoPoint(PlanetModel.SPHERE,0.5, -0.5));
+ GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points);
+ //Large polygon with arbitrary testPoint in set
+ GeoPolygon largePolygon = new GeoComplexPolygon(PlanetModel.SPHERE, Collections.singletonList(points), new GeoPoint(PlanetModel.SPHERE, 0.25, 0), true);
+ //This point is ok
+ GeoPoint point1 = new GeoPoint(PlanetModel.SPHERE, 0, 1e-8);
+ assertTrue(polygon.isWithin(point1) == largePolygon.isWithin(point1));
+ //This point is ok
+ point1 = new GeoPoint(PlanetModel.SPHERE, 0, 1e-5);
+ assertTrue(polygon.isWithin(point1) == largePolygon.isWithin(point1));
+ //Fails here
+ point1 = new GeoPoint(PlanetModel.SPHERE, 0, 1e-7);
+ assertTrue(polygon.isWithin(point1) == largePolygon.isWithin(point1));
+ }
+
+ @Ignore
+ @Test
+ public void testComplexPolygonDegeneratedVector() {
+ List<GeoPoint> points = new ArrayList<>();
+ points.add(new GeoPoint(PlanetModel.SPHERE, -0.5, -0.5));
+ points.add(new GeoPoint(PlanetModel.SPHERE, -0.5, 0.5));
+ points.add(new GeoPoint(PlanetModel.SPHERE, 0.5, 0.5));
+ points.add(new GeoPoint(PlanetModel.SPHERE,0.5, -0.5));
+ final GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points);
+ //Large polygon with test point in (0,0)
+ final GeoPolygon largePolygon = new GeoComplexPolygon(PlanetModel.SPHERE, Collections.singletonList(points), new GeoPoint(PlanetModel.SPHERE, 0.0, 0), true);
+ //Chooses Plane Z and succeed
+ final GeoPoint point1 = new GeoPoint(PlanetModel.SPHERE, 0, 1e-5);
+ assertTrue(polygon.isWithin(point1) == largePolygon.isWithin(point1));
+ //Numerically identical
+ final GeoPoint point2 = new GeoPoint(PlanetModel.SPHERE, 0, 1e-13);
+ assertTrue(polygon.isWithin(point2) == largePolygon.isWithin(point2));
+ //Fails here, chooses plane X
+ final GeoPoint point3 = new GeoPoint(PlanetModel.SPHERE, 0, 1e-6);
+ assertTrue(polygon.isWithin(point3) == largePolygon.isWithin(point3));
+ }
}