lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject lucene-solr:branch_6x: LUCENE-8251: Add AwaitsFix for the tests that this issue covers.
Date Fri, 13 Apr 2018 13:41:40 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 861362796 -> a97738a65


LUCENE-8251: Add AwaitsFix for the tests that this issue covers.


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

Branch: refs/heads/branch_6x
Commit: a97738a659aebaae153168b7fdddee5709f2abc2
Parents: 8613627
Author: Karl Wright <DaddyWri@gmail.com>
Authored: Fri Apr 13 09:39:31 2018 -0400
Committer: Karl Wright <DaddyWri@gmail.com>
Committed: Fri Apr 13 09:41:30 2018 -0400

----------------------------------------------------------------------
 .../spatial3d/geom/GeoComplexPolygon.java       | 30 +++++++++++++-------
 .../lucene/spatial3d/geom/GeoPolygonTest.java   | 17 +++++------
 .../spatial3d/geom/RandomGeoPolygonTest.java    |  2 +-
 3 files changed, 29 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a97738a6/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
index c4e2c93..b6b6577 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
@@ -1146,12 +1146,17 @@ class GeoComplexPolygon extends GeoBasePolygon {
       this.intersectionPoint = intersectionPoint;
       
       //System.out.println("Intersection point = "+intersectionPoint);
-        
+      //System.out.println("TestPoint plane: "+testPoint+" -> "+intersectionPoint);
+      //System.out.println("Travel plane: ["+thePointX+","+thePointY+","+thePointZ+"] ->
"+intersectionPoint);
+      
       assert travelPlane.evaluateIsZero(intersectionPoint) : "intersection point must be
on travel plane";
       assert testPointPlane.evaluateIsZero(intersectionPoint) : "intersection point must
be on test point plane";
-        
+      
+      //System.out.println("Test point distance to intersection point: "+intersectionPoint.linearDistance(testPoint));
+      //System.out.println("Check point distance to intersection point: "+intersectionPoint.linearDistance(thePointX,
thePointY, thePointZ));
+
       assert !testPoint.isNumericallyIdentical(intersectionPoint) : "test point is the same
as intersection point";
-      assert !intersectionPoint.isNumericallyIdentical(thePointX, thePointY, thePointZ) :
"check point is same is intersection point";
+      assert !intersectionPoint.isNumericallyIdentical(thePointX, thePointY, thePointZ) :
"check point is same as intersection point";
 
       this.testPointCutoffPlane = new SidedPlane(intersectionPoint, testPointPlane, testPoint);
       this.checkPointCutoffPlane = new SidedPlane(intersectionPoint, travelPlane, thePointX,
thePointY, thePointZ);
@@ -1324,7 +1329,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
       System.out.println("");
       System.out.println("Considering edge "+(edge.startPoint)+" -> "+(edge.endPoint));
       */
-      
+
       // Some edges are going to be given to us even when there's no real intersection, so
do that as a sanity check, first.
       final GeoPoint[] travelCrossings = travelPlane.findIntersections(planetModel, edge.plane,
checkPointCutoffPlane, checkPointOtherCutoffPlane, edge.startPlane, edge.endPlane);
       if (travelCrossings != null && travelCrossings.length == 0) {
@@ -1442,7 +1447,10 @@ class GeoComplexPolygon extends GeoBasePolygon {
 
   }
   
-    
+  /** This is the amount we go, roughly, in both directions, to find adjoining points to
test.  If we go too far,
+    * we might miss a transition, but if we go too little, we might not see it either due
to numerical issues.
+    */
+  private final static double DELTA_DISTANCE = Vector.MINIMUM_RESOLUTION;// * 0.5;
   
   /** Given a point on the plane and the ellipsoid, this method looks for a pair of adjoining
points on either side of the plane, which are
    * about MINIMUM_RESOLUTION away from the given point.  This only works for planes which
go through the center of the world.
@@ -1451,12 +1459,12 @@ class GeoComplexPolygon extends GeoBasePolygon {
     // Compute a normalized perpendicular vector
     final Vector perpendicular = new Vector(plane, pointOnPlane);
     // Compute two new points along this vector from the original
-    final GeoPoint pointA = planetModel.createSurfacePoint(pointOnPlane.x + perpendicular.x
* Vector.MINIMUM_RESOLUTION,
-      pointOnPlane.y + perpendicular.y * Vector.MINIMUM_RESOLUTION,
-      pointOnPlane.z + perpendicular.z * Vector.MINIMUM_RESOLUTION);
-    final GeoPoint pointB = planetModel.createSurfacePoint(pointOnPlane.x - perpendicular.x
* Vector.MINIMUM_RESOLUTION,
-      pointOnPlane.y - perpendicular.y * Vector.MINIMUM_RESOLUTION,
-      pointOnPlane.z - perpendicular.z * Vector.MINIMUM_RESOLUTION);
+    final GeoPoint pointA = planetModel.createSurfacePoint(pointOnPlane.x + perpendicular.x
* DELTA_DISTANCE,
+      pointOnPlane.y + perpendicular.y * DELTA_DISTANCE,
+      pointOnPlane.z + perpendicular.z * DELTA_DISTANCE);
+    final GeoPoint pointB = planetModel.createSurfacePoint(pointOnPlane.x - perpendicular.x
* DELTA_DISTANCE,
+      pointOnPlane.y - perpendicular.y * DELTA_DISTANCE,
+      pointOnPlane.z - perpendicular.z * DELTA_DISTANCE);
     //System.out.println("Distance: "+computeSquaredDistance(rval[0], pointOnPlane)+" and
"+computeSquaredDistance(rval[1], pointOnPlane));
     return new GeoPoint[]{pointA, pointB};
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a97738a6/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 e720cb2..86f5694 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
@@ -1570,20 +1570,21 @@ shape:
   }
   
   @Test
+  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8251")
   public void testLUCENE8251() {
     //POLYGON((135.63207358036593 -51.43541696593334,113.00782694696038 -58.984559858566556,0.0
-3.68E-321,-66.33598777585381 -7.382056816201731,135.63207358036593 -51.43541696593334))
     final List<GeoPoint> points = new ArrayList<>();
-    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-51.43541696593334),
Geo3DUtil.fromDegrees(135.63207358036593)));
-    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-58.984559858566556),
Geo3DUtil.fromDegrees(113.00782694696038)));
-    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-3.68E-321), Geo3DUtil.fromDegrees(0.0)));
-    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-7.382056816201731),
Geo3DUtil.fromDegrees(-66.33598777585381)));
-    points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-51.43541696593334),
Geo3DUtil.fromDegrees(135.63207358036593)));
+    points.add(new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(-51.43541696593334),
Geo3DUtil.fromDegrees(135.63207358036593)));
+    points.add(new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(-58.984559858566556),
Geo3DUtil.fromDegrees(113.00782694696038)));
+    points.add(new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(-3.68E-321), Geo3DUtil.fromDegrees(0.0)));
+    points.add(new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(-7.382056816201731),
Geo3DUtil.fromDegrees(-66.33598777585381)));
+    points.add(new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(-51.43541696593334),
Geo3DUtil.fromDegrees(135.63207358036593)));
     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));
+    final GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(PlanetModel.WGS84, description);
+    final GeoPolygon largePolygon = GeoPolygonFactory.makeLargeGeoPolygon(PlanetModel.WGS84,
Collections.singletonList(description));
 
     //POINT(0.005183505059185348 1.98E-321)
-    final GeoPoint point = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(1.98E-321),
Geo3DUtil.fromDegrees(0.005183505059185348));
+    final GeoPoint point = new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(1.98E-321),
Geo3DUtil.fromDegrees(0.005183505059185348));
     assertTrue(polygon.isWithin(point) == largePolygon.isWithin(point));
   }
   

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a97738a6/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
index 6c5e890..b6364e0 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeoPolygonTest.java
@@ -92,7 +92,7 @@ public class RandomGeoPolygonTest extends RandomGeo3dShapeGenerator {
    * biased doubles.
    */
   @Test
-  //@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8251")
+  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8251")
   @Repeat(iterations = 10)
   public void testComparePolygons() {
     final PlanetModel planetModel = randomPlanetModel();


Mime
View raw message