You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/08/21 21:28:56 UTC
svn commit: r1697048 - in
/lucene/dev/branches/lucene6699/lucene/spatial3d/src:
java/org/apache/lucene/geo3d/GeoCircle.java
java/org/apache/lucene/geo3d/Vector.java
test/org/apache/lucene/geo3d/GeoCircleTest.java
Author: mikemccand
Date: Fri Aug 21 19:28:55 2015
New Revision: 1697048
URL: http://svn.apache.org/r1697048
Log:
LUCENE-6699: throw IllegalArgExc for too-small GeoCircles; increase MINIMUM_RESOLUTION again
Modified:
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoCircle.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Vector.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoCircle.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoCircle.java?rev=1697048&r1=1697047&r2=1697048&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoCircle.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoCircle.java Fri Aug 21 19:28:55 2015
@@ -46,8 +46,10 @@ public class GeoCircle extends GeoBaseDi
throw new IllegalArgumentException("Latitude out of bounds");
if (lon < -Math.PI || lon > Math.PI)
throw new IllegalArgumentException("Longitude out of bounds");
- if (cutoffAngle <= 0.0 || cutoffAngle > Math.PI)
+ if (cutoffAngle < 0.0 || cutoffAngle > Math.PI)
throw new IllegalArgumentException("Cutoff angle out of bounds");
+ if (cutoffAngle < Vector.MINIMUM_RESOLUTION)
+ throw new IllegalArgumentException("Cutoff angle cannot be effectively zero");
this.center = new GeoPoint(planetModel, lat, lon);
// In an ellipsoidal world, cutoff distances make no sense, unfortunately. Only membership
// can be used to make in/out determination.
@@ -137,6 +139,8 @@ public class GeoCircle extends GeoBaseDi
return;
}
bounds.addPoint(center);
+ // Cheap way of preventing bounds from not agreeing with edgepoint perfectly
+ bounds.addPoint(edgePoints[0]);
bounds.addPlane(planetModel, circlePlane);
}
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Vector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Vector.java?rev=1697048&r1=1697047&r2=1697048&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Vector.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Vector.java Fri Aug 21 19:28:55 2015
@@ -28,7 +28,7 @@ public class Vector {
* Values that are all considered to be essentially zero have a magnitude
* less than this.
*/
- public static final double MINIMUM_RESOLUTION = 2e-11;
+ public static final double MINIMUM_RESOLUTION = 7.5e-11;
/**
* For squared quantities, the bound is squared too.
*/
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java?rev=1697048&r1=1697047&r2=1697048&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java Fri Aug 21 19:28:55 2015
@@ -98,6 +98,15 @@ public class GeoCircleTest {
GeoArea area;
GeoPoint p1;
GeoPoint p2;
+
+ // Fifth BKD discovered failure
+ c = new GeoCircle(PlanetModel.SPHERE, -0.004282454525970269, -1.6739831367422277E-4, 1.959639723134033E-6);
+ assertTrue(c.isWithin(c.getEdgePoints()[0]));
+ xyzb = new XYZBounds();
+ c.getBounds(xyzb);
+ area = GeoAreaFactory.makeGeoArea(PlanetModel.SPHERE,
+ xyzb.getMinimumX(), xyzb.getMaximumX(), xyzb.getMinimumY(), xyzb.getMaximumY(), xyzb.getMinimumZ(), xyzb.getMaximumZ());
+ assertTrue(GeoArea.WITHIN == area.getRelationship(c) || GeoArea.OVERLAPS == area.getRelationship(c));
// Fourth BKD discovered failure
c = new GeoCircle(PlanetModel.SPHERE, -0.0048795517261255, 0.004053904306995974, 5.93699764258874E-6);