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 2016/06/28 10:27:47 UTC

[1/2] lucene-solr:master: LUCENE-7357: If the points for path segment intersections are ambiguous, throw an IllegalArgumentException.

Repository: lucene-solr
Updated Branches:
  refs/heads/master 8c47d20d2 -> 7343b0547


LUCENE-7357: If the points for path segment intersections are ambiguous, throw an IllegalArgumentException.


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

Branch: refs/heads/master
Commit: d954c78cea8c7ae3777f8ed55c61a455d716443a
Parents: 36183ca
Author: Karl Wright <Da...@gmail.com>
Authored: Tue Jun 28 06:27:21 2016 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Tue Jun 28 06:27:21 2016 -0400

----------------------------------------------------------------------
 .../lucene/spatial3d/geom/GeoStandardPath.java  | 35 +++++++++++++++-----
 .../apache/lucene/spatial3d/geom/XYZBounds.java |  2 +-
 .../lucene/spatial3d/geom/GeoPathTest.java      | 35 ++++++++++++++++++++
 3 files changed, 63 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d954c78c/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
index 0f06717..51c5078 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
@@ -244,12 +244,14 @@ class GeoStandardPath extends GeoBasePath {
   @Override
   public boolean isWithin(final double x, final double y, final double z) {
     for (SegmentEndpoint pathPoint : endPoints) {
-      if (pathPoint.isWithin(x, y, z))
+      if (pathPoint.isWithin(x, y, z)) {
         return true;
+      }
     }
     for (PathSegment pathSegment : segments) {
-      if (pathSegment.isWithin(x, y, z))
+      if (pathSegment.isWithin(x, y, z)) {
         return true;
+      }
     }
     return false;
   }
@@ -626,7 +628,7 @@ class GeoStandardPath extends GeoBasePath {
       this.start = start;
       this.end = end;
       this.normalizedConnectingPlane = normalizedConnectingPlane;
-        
+      
       // Either start or end should be on the correct side
       upperConnectingPlane = new SidedPlane(start, normalizedConnectingPlane, -planeBoundingOffset);
       lowerConnectingPlane = new SidedPlane(start, normalizedConnectingPlane, planeBoundingOffset);
@@ -642,21 +644,33 @@ class GeoStandardPath extends GeoBasePath {
       if (points.length == 0) {
         throw new IllegalArgumentException("Some segment boundary points are off the ellipsoid; path too wide");
       }
+      if (points.length > 1) {
+        throw new IllegalArgumentException("Ambiguous boundary points; path too short");
+      }
       this.ULHC = points[0];
       points = upperConnectingPlane.findIntersections(planetModel, endCutoffPlane, lowerSide, startSide);
       if (points.length == 0) {
         throw new IllegalArgumentException("Some segment boundary points are off the ellipsoid; path too wide");
       }
+      if (points.length > 1) {
+        throw new IllegalArgumentException("Ambiguous boundary points; path too short");
+      }
       this.URHC = points[0];
       points = lowerConnectingPlane.findIntersections(planetModel, startCutoffPlane, upperSide, endSide);
       if (points.length == 0) {
         throw new IllegalArgumentException("Some segment boundary points are off the ellipsoid; path too wide");
       }
+      if (points.length > 1) {
+        throw new IllegalArgumentException("Ambiguous boundary points; path too short");
+      }
       this.LLHC = points[0];
       points = lowerConnectingPlane.findIntersections(planetModel, endCutoffPlane, upperSide, startSide);
       if (points.length == 0) {
         throw new IllegalArgumentException("Some segment boundary points are off the ellipsoid; path too wide");
       }
+      if (points.length > 1) {
+        throw new IllegalArgumentException("Ambiguous boundary points; path too short");
+      }
       this.LRHC = points[0];
       upperConnectingPlanePoints = new GeoPoint[]{ULHC, URHC};
       lowerConnectingPlanePoints = new GeoPoint[]{LLHC, LRHC};
@@ -791,11 +805,16 @@ class GeoStandardPath extends GeoBasePath {
      */
     public void getBounds(final PlanetModel planetModel, Bounds bounds) {
       // We need to do all bounding planes as well as corner points
-      bounds.addPoint(start).addPoint(end).addPoint(ULHC).addPoint(URHC).addPoint(LRHC).addPoint(LLHC);
-      bounds.addPlane(planetModel, upperConnectingPlane, lowerConnectingPlane, startCutoffPlane, endCutoffPlane);
-      bounds.addPlane(planetModel, lowerConnectingPlane, upperConnectingPlane, startCutoffPlane, endCutoffPlane);
-      bounds.addPlane(planetModel, startCutoffPlane, endCutoffPlane, upperConnectingPlane, lowerConnectingPlane);
-      bounds.addPlane(planetModel, endCutoffPlane, startCutoffPlane, upperConnectingPlane, lowerConnectingPlane);
+      bounds.addPoint(start).addPoint(end)
+        .addPoint(ULHC).addPoint(URHC).addPoint(LRHC).addPoint(LLHC)
+        .addPlane(planetModel, upperConnectingPlane, lowerConnectingPlane, startCutoffPlane, endCutoffPlane)
+        .addPlane(planetModel, lowerConnectingPlane, upperConnectingPlane, startCutoffPlane, endCutoffPlane)
+        .addPlane(planetModel, startCutoffPlane, endCutoffPlane, upperConnectingPlane, lowerConnectingPlane)
+        .addPlane(planetModel, endCutoffPlane, startCutoffPlane, upperConnectingPlane, lowerConnectingPlane)
+        .addIntersection(planetModel, upperConnectingPlane, startCutoffPlane, lowerConnectingPlane, endCutoffPlane)
+        .addIntersection(planetModel, startCutoffPlane, lowerConnectingPlane, endCutoffPlane, upperConnectingPlane)
+        .addIntersection(planetModel, lowerConnectingPlane, endCutoffPlane, upperConnectingPlane, startCutoffPlane)
+        .addIntersection(planetModel, endCutoffPlane, upperConnectingPlane, startCutoffPlane, lowerConnectingPlane);
     }
 
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d954c78c/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.java
index 9f44157..85659ab 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZBounds.java
@@ -30,7 +30,7 @@ public class XYZBounds implements Bounds {
    * unacceptably large.
    * Also, see LUCENE-7290 for a description of how geometry can magnify the bounds delta.
    */
-  private static final double FUDGE_FACTOR = Vector.MINIMUM_RESOLUTION * 1000.0;
+  private static final double FUDGE_FACTOR = Vector.MINIMUM_RESOLUTION * 1e3;
   
   /** Minimum x */
   private Double minX = null;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d954c78c/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java
index f5dd8b0..648854e 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java
@@ -267,4 +267,39 @@ public class GeoPathTest {
     p.done();//at least test this doesn't bomb like it used too -- LUCENE-6520
   }
 
+  @Test
+  public void testFailure1() {
+    /*
+   GeoStandardPath: {planetmodel=PlanetModel.WGS84, width=1.117010721276371(64.0), points={[
+   [lat=2.18531083006635E-12, lon=-3.141592653589793([X=-1.0011188539924791, Y=-1.226017000107956E-16, Z=2.187755873813378E-12])], 
+   [lat=0.0, lon=-3.141592653589793([X=-1.0011188539924791, Y=-1.226017000107956E-16, Z=0.0])]]}}
+    */
+    final GeoPoint[] points = new GeoPoint[]{
+      new GeoPoint(PlanetModel.WGS84, 2.18531083006635E-12, -3.141592653589793),
+      new GeoPoint(PlanetModel.WGS84, 0.0, -3.141592653589793)};
+    
+    final GeoPath path;
+    try {
+      path = GeoPathFactory.makeGeoPath(PlanetModel.WGS84,
+        1.117010721276371, points);
+    } catch (IllegalArgumentException e) {
+      return;
+    }
+    assertTrue(false);
+    
+    final GeoPoint point = new GeoPoint(PlanetModel.WGS84, -2.848117399637174E-91, -1.1092122135274942);
+    System.err.println("point = "+point);
+      
+    final XYZBounds bounds = new XYZBounds();
+    path.getBounds(bounds);
+      
+    final XYZSolid solid = XYZSolidFactory.makeXYZSolid(PlanetModel.WGS84,
+      bounds.getMinimumX(), bounds.getMaximumX(),
+      bounds.getMinimumY(), bounds.getMaximumY(),
+      bounds.getMinimumZ(), bounds.getMaximumZ());
+      
+    assertTrue(path.isWithin(point));
+    assertTrue(solid.isWithin(point));
+  }
+  
 }


[2/2] lucene-solr:master: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr

Posted by kw...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr


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

Branch: refs/heads/master
Commit: 7343b0547d54a9dc28e7661ee7ed756fd522776b
Parents: d954c78 8c47d20
Author: Karl Wright <Da...@gmail.com>
Authored: Tue Jun 28 06:27:33 2016 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Tue Jun 28 06:27:33 2016 -0400

----------------------------------------------------------------------
 dev-tools/scripts/addBackcompatIndexes.py |  5 +-
 dev-tools/scripts/manageRelease.py        | 90 -------------------------
 dev-tools/scripts/releasedJirasRegex.py   | 93 ++++++++++++++++++++++++++
 3 files changed, 94 insertions(+), 94 deletions(-)
----------------------------------------------------------------------