From commits-return-100351-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Fri Apr 13 15:41:42 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B113C180627 for ; Fri, 13 Apr 2018 15:41:41 +0200 (CEST) Received: (qmail 91181 invoked by uid 500); 13 Apr 2018 13:41:40 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 91172 invoked by uid 99); 13 Apr 2018 13:41:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2018 13:41:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5029DE96AE; Fri, 13 Apr 2018 13:41:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kwright@apache.org To: commits@lucene.apache.org Message-Id: <71b7827a2e9c41679d026e397b9cfe0c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: lucene-solr:branch_6x: LUCENE-8251: Add AwaitsFix for the tests that this issue covers. Date: Fri, 13 Apr 2018 13:41:40 +0000 (UTC) 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 Authored: Fri Apr 13 09:39:31 2018 -0400 Committer: Karl Wright 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 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();