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/29 17:22:38 UTC
svn commit: r1700049 - in
/lucene/dev/branches/lucene6699/lucene/spatial3d/src:
java/org/apache/lucene/bkdtree3d/ java/org/apache/lucene/geo3d/
test/org/apache/lucene/bkdtree3d/ test/org/apache/lucene/geo3d/
Author: mikemccand
Date: Sat Aug 29 15:22:38 2015
New Revision: 1700049
URL: http://svn.apache.org/r1700049
Log:
LUCENE-6699: iterate
Modified:
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/PlanetModel.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZSolid.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYdZSolid.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XdYZSolid.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXYZSolid.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestGeo3DPointField.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.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/bkdtree3d/PointInGeo3DShapeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java?rev=1700049&r1=1700048&r2=1700049&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/bkdtree3d/PointInGeo3DShapeQuery.java Sat Aug 29 15:22:38 2015
@@ -116,6 +116,7 @@ public class PointInGeo3DShapeQuery exte
// the box. Otherwise according to the (revised) definition of getRelationship(),
// you could technically get either one.
+ // nocommit can we also remove this inflate?
double inflate = 2.0 * Vector.MINIMUM_RESOLUTION;
DocIdSet result = tree.intersect(Geo3DDocValuesFormat.encodeValueLenient(planetModel, bounds.getMinimumX() - inflate),
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/PlanetModel.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/PlanetModel.java?rev=1700049&r1=1700048&r2=1700049&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/PlanetModel.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/PlanetModel.java Sat Aug 29 15:22:38 2015
@@ -169,6 +169,25 @@ public class PlanetModel {
// x^2 / a^2 + y^2 / b^2 + z^2 / c^2 - 1 = 0
return Math.abs((x * x + y * y) * inverseAb * inverseAb + z * z * inverseC * inverseC - 1.0) < Vector.MINIMUM_RESOLUTION;
}
+
+ /** Check if point is outside surface.
+ * @param v is the point to check.
+ * @return true if the point is outside the planet surface.
+ */
+ public boolean pointOutside(final Vector v) {
+ return pointOutside(v.x, v.y, v.z);
+ }
+
+ /** Check if point is outside surface.
+ * @param x is the x coord.
+ * @param y is the y coord.
+ * @param z is the z coord.
+ */
+ public boolean pointOutside(final double x, final double y, final double z) {
+ // Equation of planet surface is:
+ // x^2 / a^2 + y^2 / b^2 + z^2 / c^2 - 1 = 0
+ return (x * x + y * y) * inverseAb * inverseAb + z * z * inverseC * inverseC - 1.0 > Vector.MINIMUM_RESOLUTION;
+ }
/** Compute surface distance between two points.
* @param p1 is the first point.
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZSolid.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZSolid.java?rev=1700049&r1=1700048&r2=1700049&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZSolid.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZSolid.java Sat Aug 29 15:22:38 2015
@@ -159,72 +159,65 @@ public class XYZSolid extends BaseXYZSol
GeoPoint[] edgePoints = findLargestSolution(minXminY,minXmaxY,minXminZ,minXmaxZ,
maxXminY,maxXmaxY,maxXminZ,maxXmaxZ,
minYminZ,minYmaxZ,maxYminZ,maxYmaxZ);
-
if (edgePoints.length == 0) {
+ // The cases we are looking for are when the four corner points for any given
+ // plane are all outside of the world, AND that plane intersects the world.
+ // There are eight corner points all told; we must evaluate these WRT the planet surface.
+ final boolean minXminYminZ = planetModel.pointOutside(minX, minY, minZ);
+ final boolean minXminYmaxZ = planetModel.pointOutside(minX, minY, maxZ);
+ final boolean minXmaxYminZ = planetModel.pointOutside(minX, maxY, minZ);
+ final boolean minXmaxYmaxZ = planetModel.pointOutside(minX, maxY, maxZ);
+ final boolean maxXminYminZ = planetModel.pointOutside(maxX, minY, minZ);
+ final boolean maxXminYmaxZ = planetModel.pointOutside(maxX, minY, maxZ);
+ final boolean maxXmaxYminZ = planetModel.pointOutside(maxX, maxY, minZ);
+ final boolean maxXmaxYmaxZ = planetModel.pointOutside(maxX, maxY, maxZ);
+
// If we still haven't encountered anything, we need to look at single-plane/world intersections.
// We detect these by looking at the world model and noting its x, y, and z bounds.
if (minX - worldMinX >= -Vector.MINIMUM_RESOLUTION && minX - worldMaxX <= Vector.MINIMUM_RESOLUTION &&
- (maxX - worldMaxX > Vector.MINIMUM_RESOLUTION) &&
- (minY - worldMinY < -Vector.MINIMUM_RESOLUTION) &&
- (maxY - worldMaxY > Vector.MINIMUM_RESOLUTION) &&
- (minZ - worldMinZ < -Vector.MINIMUM_RESOLUTION) &&
- (maxZ - worldMaxZ > Vector.MINIMUM_RESOLUTION)) {
+ minY < 0.0 && maxY > 0.0 && minZ < 0.0 && maxZ > 0.0 &&
+ minXminYminZ && minXminYmaxZ && minXmaxYminZ && minXmaxYmaxZ) {
// Find any point on the minX plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (1,0,0)
// Then use it to compute a sample point.
edgePoints = new GeoPoint[]{minXPlane.getSampleIntersectionPoint(planetModel, xVerticalPlane)};
} else if (maxX - worldMinX >= -Vector.MINIMUM_RESOLUTION && maxX - worldMaxX <= Vector.MINIMUM_RESOLUTION &&
- (minX - worldMinX < -Vector.MINIMUM_RESOLUTION) &&
- (minY - worldMinY < -Vector.MINIMUM_RESOLUTION) &&
- (maxY - worldMaxY > Vector.MINIMUM_RESOLUTION) &&
- (minZ - worldMinZ < -Vector.MINIMUM_RESOLUTION) &&
- (maxZ - worldMaxZ > Vector.MINIMUM_RESOLUTION)) {
+ minY < 0.0 && maxY > 0.0 && minZ < 0.0 && maxZ > 0.0 &&
+ maxXminYminZ && maxXminYmaxZ && maxXmaxYminZ && maxXmaxYmaxZ) {
// Find any point on the maxX plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (1,0,0)
// Then use it to compute a sample point.
edgePoints = new GeoPoint[]{maxXPlane.getSampleIntersectionPoint(planetModel, xVerticalPlane)};
} else if (minY - worldMinY >= -Vector.MINIMUM_RESOLUTION && minY - worldMaxY <= Vector.MINIMUM_RESOLUTION &&
- (maxY - worldMaxY > Vector.MINIMUM_RESOLUTION) &&
- (minX - worldMinX < -Vector.MINIMUM_RESOLUTION) &&
- (maxX - worldMaxX > Vector.MINIMUM_RESOLUTION) &&
- (minZ - worldMinZ < -Vector.MINIMUM_RESOLUTION) &&
- (maxZ - worldMaxZ > Vector.MINIMUM_RESOLUTION)) {
+ minX < 0.0 && maxX > 0.0 && minZ < 0.0 && maxZ > 0.0 &&
+ minXminYminZ && minXminYmaxZ && maxXminYminZ && maxXminYmaxZ) {
// Find any point on the minY plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (0,1,0)
// Then use it to compute a sample point.
edgePoints = new GeoPoint[]{minYPlane.getSampleIntersectionPoint(planetModel, yVerticalPlane)};
} else if (maxY - worldMinY >= -Vector.MINIMUM_RESOLUTION && maxY - worldMaxY <= Vector.MINIMUM_RESOLUTION &&
- (minY - worldMinY < -Vector.MINIMUM_RESOLUTION) &&
- (minX - worldMinX < -Vector.MINIMUM_RESOLUTION) &&
- (maxX - worldMaxX > Vector.MINIMUM_RESOLUTION) &&
- (minZ - worldMinZ < -Vector.MINIMUM_RESOLUTION) &&
- (maxZ - worldMaxZ > Vector.MINIMUM_RESOLUTION)) {
+ minX < 0.0 && maxX > 0.0 && minZ < 0.0 && maxZ > 0.0 &&
+ minXmaxYminZ && minXmaxYmaxZ && maxXmaxYminZ && maxXmaxYmaxZ) {
// Find any point on the maxY plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (0,1,0)
// Then use it to compute a sample point.
edgePoints = new GeoPoint[]{maxYPlane.getSampleIntersectionPoint(planetModel, yVerticalPlane)};
} else if (minZ - worldMinZ >= -Vector.MINIMUM_RESOLUTION && minZ - worldMaxZ <= Vector.MINIMUM_RESOLUTION &&
- (maxZ - worldMaxZ > Vector.MINIMUM_RESOLUTION) &&
- (minY - worldMinY < -Vector.MINIMUM_RESOLUTION) &&
- (maxY - worldMaxY > Vector.MINIMUM_RESOLUTION) &&
- (minX - worldMinX < -Vector.MINIMUM_RESOLUTION) &&
- (maxX - worldMaxX > Vector.MINIMUM_RESOLUTION)) {
+ minX < 0.0 && maxX > 0.0 && minY < 0.0 && maxY > 0.0 &&
+ minXminYminZ && minXmaxYminZ && maxXminYminZ && maxXmaxYminZ) {
// Find any point on the minZ plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (1,0,0)
// Then use it to compute a sample point.
edgePoints = new GeoPoint[]{minZPlane.getSampleIntersectionPoint(planetModel, xVerticalPlane)};
} else if (maxZ - worldMinZ >= -Vector.MINIMUM_RESOLUTION && maxZ - worldMaxZ <= Vector.MINIMUM_RESOLUTION &&
- (minZ - worldMinZ < -Vector.MINIMUM_RESOLUTION) &&
- (minY - worldMinY < -Vector.MINIMUM_RESOLUTION) &&
- (maxY - worldMaxY > Vector.MINIMUM_RESOLUTION) &&
- (minX - worldMinX < -Vector.MINIMUM_RESOLUTION) &&
- (maxX - worldMaxX > Vector.MINIMUM_RESOLUTION)) {
+ minX < 0.0 && maxX > 0.0 && minY < 0.0 && maxY > 0.0 &&
+ minXminYmaxZ && minXmaxYmaxZ && maxXminYmaxZ && maxXmaxYmaxZ) {
// Find any point on the maxZ plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (1,0,0) (that is, its orientation doesn't matter)
@@ -232,7 +225,7 @@ public class XYZSolid extends BaseXYZSol
edgePoints = new GeoPoint[]{maxZPlane.getSampleIntersectionPoint(planetModel, xVerticalPlane)};
}
}
-
+
this.edgePoints = edgePoints;
}
}
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYdZSolid.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYdZSolid.java?rev=1700049&r1=1700048&r2=1700049&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYdZSolid.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYdZSolid.java Sat Aug 29 15:22:38 2015
@@ -101,12 +101,17 @@ public class XYdZSolid extends BaseXYZSo
if (edgePoints.length == 0) {
// If we still haven't encountered anything, we need to look at single-plane/world intersections.
// We detect these by looking at the world model and noting its x, y, and z bounds.
+ // The cases we are looking for are when the four corner points for any given
+ // plane are all outside of the world, AND that plane intersects the world.
+ // There are four corner points all told; we must evaluate these WRT the planet surface.
+ final boolean minXminYZ = planetModel.pointOutside(minX, minY, Z);
+ final boolean minXmaxYZ = planetModel.pointOutside(minX, maxY, Z);
+ final boolean maxXminYZ = planetModel.pointOutside(maxX, minY, Z);
+ final boolean maxXmaxYZ = planetModel.pointOutside(maxX, maxY, Z);
if (Z - worldMinZ >= -Vector.MINIMUM_RESOLUTION && Z - worldMaxZ <= Vector.MINIMUM_RESOLUTION &&
- (minY - worldMinY < -Vector.MINIMUM_RESOLUTION) &&
- (maxY - worldMaxY > Vector.MINIMUM_RESOLUTION) &&
- (minX - worldMinX < -Vector.MINIMUM_RESOLUTION) &&
- (maxX - worldMaxX > Vector.MINIMUM_RESOLUTION)) {
+ minX < 0.0 && maxX > 0.0 && minY < 0.0 && maxY > 0.0 &&
+ minXminYZ && minXmaxYZ && maxXminYZ && maxXmaxYZ) {
// Find any point on the minZ plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (1,0,0)
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XdYZSolid.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XdYZSolid.java?rev=1700049&r1=1700048&r2=1700049&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XdYZSolid.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XdYZSolid.java Sat Aug 29 15:22:38 2015
@@ -101,12 +101,17 @@ public class XdYZSolid extends BaseXYZSo
if (edgePoints.length == 0) {
// If we still haven't encountered anything, we need to look at single-plane/world intersections.
// We detect these by looking at the world model and noting its x, y, and z bounds.
+ // The cases we are looking for are when the four corner points for any given
+ // plane are all outside of the world, AND that plane intersects the world.
+ // There are four corner points all told; we must evaluate these WRT the planet surface.
+ final boolean minXYminZ = planetModel.pointOutside(minX, Y, minZ);
+ final boolean minXYmaxZ = planetModel.pointOutside(minX, Y, maxZ);
+ final boolean maxXYminZ = planetModel.pointOutside(maxX, Y, minZ);
+ final boolean maxXYmaxZ = planetModel.pointOutside(maxX, Y, maxZ);
if (Y - worldMinY >= -Vector.MINIMUM_RESOLUTION && Y - worldMaxY <= Vector.MINIMUM_RESOLUTION &&
- (minX - worldMinX < -Vector.MINIMUM_RESOLUTION) &&
- (maxX - worldMaxX > Vector.MINIMUM_RESOLUTION) &&
- (minZ - worldMinZ < -Vector.MINIMUM_RESOLUTION) &&
- (maxZ - worldMaxZ > Vector.MINIMUM_RESOLUTION)) {
+ minX < 0.0 && maxX > 0.0 && minZ < 0.0 && maxZ > 0.0 &&
+ minXYminZ && minXYmaxZ && maxXYminZ && maxXYmaxZ) {
// Find any point on the minY plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (0,1,0)
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXYZSolid.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXYZSolid.java?rev=1700049&r1=1700048&r2=1700049&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXYZSolid.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXYZSolid.java Sat Aug 29 15:22:38 2015
@@ -102,12 +102,17 @@ public class dXYZSolid extends BaseXYZSo
// If we still haven't encountered anything, we need to look at single-plane/world intersections.
// We detect these by looking at the world model and noting its x, y, and z bounds.
// For the single-dimension degenerate case, there's really only one plane that can possibly intersect the world.
-
+ // The cases we are looking for are when the four corner points for any given
+ // plane are all outside of the world, AND that plane intersects the world.
+ // There are four corner points all told; we must evaluate these WRT the planet surface.
+ final boolean XminYminZ = planetModel.pointOutside(X, minY, minZ);
+ final boolean XminYmaxZ = planetModel.pointOutside(X, minY, maxZ);
+ final boolean XmaxYminZ = planetModel.pointOutside(X, maxY, minZ);
+ final boolean XmaxYmaxZ = planetModel.pointOutside(X, maxY, maxZ);
+
if (X - worldMinX >= -Vector.MINIMUM_RESOLUTION && X - worldMaxX <= Vector.MINIMUM_RESOLUTION &&
- (minY - worldMinY < -Vector.MINIMUM_RESOLUTION) &&
- (maxY - worldMaxY > Vector.MINIMUM_RESOLUTION) &&
- (minZ - worldMinZ < -Vector.MINIMUM_RESOLUTION) &&
- (maxZ - worldMaxZ > Vector.MINIMUM_RESOLUTION)) {
+ minY < 0.0 && maxY > 0.0 && minZ < 0.0 && maxZ > 0.0 &&
+ XminYminZ && XminYmaxZ && XmaxYminZ && XmaxYmaxZ) {
// Find any point on the X plane that intersects the world
// First construct a perpendicular plane that will allow us to find a sample point.
// This plane is vertical and goes through the points (0,0,0) and (1,0,0)
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestGeo3DPointField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestGeo3DPointField.java?rev=1700049&r1=1700048&r2=1700049&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestGeo3DPointField.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/bkdtree3d/TestGeo3DPointField.java Sat Aug 29 15:22:38 2015
@@ -474,14 +474,13 @@ public class TestGeo3DPointField extends
shape.getBounds(bounds);
// Start with the root cell that fully contains the shape:
- double inflate = 2.0 * Vector.MINIMUM_RESOLUTION;
Cell root = new Cell(null,
- encodeValueLenient(planetModel, bounds.getMinimumX() - inflate),
- encodeValueLenient(planetModel, bounds.getMaximumX() - inflate),
- encodeValueLenient(planetModel, bounds.getMinimumY() - inflate),
- encodeValueLenient(planetModel, bounds.getMaximumY() - inflate),
- encodeValueLenient(planetModel, bounds.getMinimumZ() - inflate),
- encodeValueLenient(planetModel, bounds.getMaximumZ() - inflate),
+ encodeValueLenient(planetModel, bounds.getMinimumX()),
+ encodeValueLenient(planetModel, bounds.getMaximumX()),
+ encodeValueLenient(planetModel, bounds.getMinimumY()),
+ encodeValueLenient(planetModel, bounds.getMaximumY()),
+ encodeValueLenient(planetModel, bounds.getMinimumZ()),
+ encodeValueLenient(planetModel, bounds.getMaximumZ()),
0);
if (VERBOSE) {
@@ -528,6 +527,12 @@ public class TestGeo3DPointField extends
decodeValueMin(planetMax, cell.yMinEnc), decodeValueMax(planetMax, cell.yMaxEnc),
decodeValueMin(planetMax, cell.zMinEnc), decodeValueMax(planetMax, cell.zMaxEnc));
+ if (VERBOSE) {
+ System.out.println(" minx="+decodeValueMin(planetMax, cell.xMinEnc)+" maxx="+decodeValueMax(planetMax, cell.xMaxEnc)+
+ " miny="+decodeValueMin(planetMax, cell.yMinEnc)+" maxy="+decodeValueMax(planetMax, cell.yMaxEnc)+
+ " minz="+decodeValueMin(planetMax, cell.zMinEnc)+" maxz="+decodeValueMax(planetMax, cell.zMaxEnc));
+ }
+
switch (xyzSolid.getRelationship(shape)) {
case GeoArea.CONTAINS:
// Shape fully contains the cell: blindly add all docs in this cell:
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.java?rev=1700049&r1=1700048&r2=1700049&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.java Sat Aug 29 15:22:38 2015
@@ -141,7 +141,18 @@ public class GeoBBoxTest {
GeoBBox c;
LatLonBounds b;
XYZBounds xyzb;
-
+ GeoArea solid;
+ GeoPoint point;
+ int relationship;
+
+ c= GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.006607096847842122, -0.002828135860810422, -0.0012934461873348349, 0.006727418645092394);
+ solid = GeoAreaFactory.makeGeoArea(PlanetModel.SPHERE,0.9999995988328008,1.0000000002328306,-0.0012934708508166816,0.006727393021214471,-0.002828157275369464,0.006607074060760007);
+ point = new GeoPoint(PlanetModel.SPHERE, -5.236470872437899E-4, 3.992578692654256E-4);
+ assertTrue(c.isWithin(point));
+ assertTrue(solid.isWithin(point));
+ relationship = solid.getRelationship(c);
+ assertTrue(relationship == GeoArea.OVERLAPS || relationship == GeoArea.CONTAINS || relationship == GeoArea.WITHIN);
+
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.25, -Math.PI * 0.25, -1.0, 1.0);
b = new LatLonBounds();
c.getBounds(b);
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=1700049&r1=1700048&r2=1700049&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 Sat Aug 29 15:22:38 2015
@@ -102,6 +102,23 @@ public class GeoCircleTest extends Lucen
GeoPoint p2;
int relationship;
+ // Twelfth BKD discovered failure
+ c = new GeoCircle(PlanetModel.WGS84,-0.00824379317765984,-0.0011677469001838581,0.0011530035396910402);
+ p1 = new GeoPoint(PlanetModel.WGS84,-0.006505092992723671,0.007654282718327381);
+ p2 = new GeoPoint(1.0010681673665647,0.007662608264336381,-0.006512324005914593);
+ assertTrue(!c.isWithin(p1));
+ assertTrue(!c.isWithin(p2));
+ xyzb = new XYZBounds();
+ c.getBounds(xyzb);
+ area = GeoAreaFactory.makeGeoArea(PlanetModel.WGS84,
+ xyzb.getMinimumX(), xyzb.getMaximumX(), xyzb.getMinimumY(), xyzb.getMaximumY(), xyzb.getMinimumZ(), xyzb.getMaximumZ());
+ relationship = area.getRelationship(c);
+ assertTrue(relationship == GeoArea.OVERLAPS || relationship == GeoArea.WITHIN);
+ // Point is actually outside the bounds, and outside the shape
+ assertTrue(!area.isWithin(p1));
+ // Approximate point the same
+ assertTrue(!area.isWithin(p2));
+
// Eleventh BKD discovered failure
c = new GeoCircle(PlanetModel.SPHERE,-0.004431288600558495,-0.003687846671278374,1.704543429364245E-8);
xyzb = new XYZBounds();