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/09/01 11:40:51 UTC
svn commit: r1700450 - in
/lucene/dev/branches/lucene6699/lucene/spatial3d/src:
java/org/apache/lucene/geo3d/ test/org/apache/lucene/bkdtree3d/
test/org/apache/lucene/geo3d/
Author: mikemccand
Date: Tue Sep 1 09:40:50 2015
New Revision: 1700450
URL: http://svn.apache.org/r1700450
Log:
LUCENE-6699: increase bounds fudge factor
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/XYZBounds.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/GeoPathTest.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=1700450&r1=1700449&r2=1700450&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 Tue Sep 1 09:40:50 2015
@@ -142,8 +142,6 @@ 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/XYZBounds.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZBounds.java?rev=1700450&r1=1700449&r2=1700450&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZBounds.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZBounds.java Tue Sep 1 09:40:50 2015
@@ -30,7 +30,7 @@ public class XYZBounds implements Bounds
* of the shape, and we cannot guarantee that without making MINIMUM_RESOLUTION
* unacceptably large.
*/
- protected static final double FUDGE_FACTOR = Vector.MINIMUM_RESOLUTION * 50000.0;
+ protected static final double FUDGE_FACTOR = Vector.MINIMUM_RESOLUTION * 150000.0;
/** Minimum x */
protected Double minX = null;
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=1700450&r1=1700449&r2=1700450&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 Tue Sep 1 09:40:50 2015
@@ -429,8 +429,7 @@ public class TestGeo3DPointField extends
}
}
- private static GeoPoint quantize(PlanetModel planetModel, GeoPoint point) {
- double planetMax = planetModel.getMaximumMagnitude();
+ private static GeoPoint quantize(double planetMax, GeoPoint point) {
return new GeoPoint(decodeValueCenter(planetMax, encodeValue(planetMax, point.x)),
decodeValueCenter(planetMax, encodeValue(planetMax, point.y)),
decodeValueCenter(planetMax, encodeValue(planetMax, point.z)));
@@ -512,7 +511,7 @@ public class TestGeo3DPointField extends
for(int docID=0;docID<numDocs;docID++) {
GeoPoint point = docs[docID];
if (cell.contains(planetMax, point)) {
- if (shape.isWithin(quantize(planetModel, point))) {
+ if (shape.isWithin(quantize(planetMax, point))) {
if (VERBOSE) {
System.out.println(" check doc=" + docID + ": match!");
}
@@ -594,16 +593,22 @@ public class TestGeo3DPointField extends
if (VERBOSE) {
System.out.println(" now split on x=" + splitValue);
}
- queue.add(new Cell(cell,
+ Cell cell1 = new Cell(cell,
cell.xMinEnc, splitValue,
cell.yMinEnc, cell.yMaxEnc,
cell.zMinEnc, cell.zMaxEnc,
- cell.splitCount+1));
- queue.add(new Cell(cell,
+ cell.splitCount+1);
+ Cell cell2 = new Cell(cell,
splitValue, cell.xMaxEnc,
cell.yMinEnc, cell.yMaxEnc,
cell.zMinEnc, cell.zMaxEnc,
- cell.splitCount+1));
+ cell.splitCount+1);
+ if (VERBOSE) {
+ System.out.println(" split cell1: " + cell1);
+ System.out.println(" split cell2: " + cell2);
+ }
+ queue.add(cell1);
+ queue.add(cell2);
}
break;
@@ -614,16 +619,22 @@ public class TestGeo3DPointField extends
if (VERBOSE) {
System.out.println(" now split on y=" + splitValue);
}
- queue.add(new Cell(cell,
+ Cell cell1 = new Cell(cell,
cell.xMinEnc, cell.xMaxEnc,
cell.yMinEnc, splitValue,
cell.zMinEnc, cell.zMaxEnc,
- cell.splitCount+1));
- queue.add(new Cell(cell,
+ cell.splitCount+1);
+ Cell cell2 = new Cell(cell,
cell.xMinEnc, cell.xMaxEnc,
splitValue, cell.yMaxEnc,
cell.zMinEnc, cell.zMaxEnc,
- cell.splitCount+1));
+ cell.splitCount+1);
+ if (VERBOSE) {
+ System.out.println(" split cell1: " + cell1);
+ System.out.println(" split cell2: " + cell2);
+ }
+ queue.add(cell1);
+ queue.add(cell2);
}
break;
@@ -634,16 +645,22 @@ public class TestGeo3DPointField extends
if (VERBOSE) {
System.out.println(" now split on z=" + splitValue);
}
- queue.add(new Cell(cell,
+ Cell cell1 = new Cell(cell,
cell.xMinEnc, cell.xMaxEnc,
cell.yMinEnc, cell.yMaxEnc,
cell.zMinEnc, splitValue,
- cell.splitCount+1));
- queue.add(new Cell(cell,
+ cell.splitCount+1);
+ Cell cell2 = new Cell(cell,
cell.xMinEnc, cell.xMaxEnc,
cell.yMinEnc, cell.yMaxEnc,
splitValue, cell.zMaxEnc,
- cell.splitCount+1));
+ cell.splitCount+1);
+ if (VERBOSE) {
+ System.out.println(" split cell1: " + cell1);
+ System.out.println(" split cell2: " + cell2);
+ }
+ queue.add(cell1);
+ queue.add(cell2);
}
break;
}
@@ -658,7 +675,7 @@ public class TestGeo3DPointField extends
boolean fail = false;
for(int docID=0;docID<numDocs;docID++) {
GeoPoint point = docs[docID];
- GeoPoint quantized = quantize(planetModel, point);
+ GeoPoint quantized = quantize(planetMax, point);
boolean expected = shape.isWithin(quantized);
if (expected != shape.isWithin(point)) {
@@ -674,7 +691,7 @@ public class TestGeo3DPointField extends
System.out.println("doc=" + docID + " did not match but should");
}
System.out.println(" point=" + docs[docID]);
- System.out.println(" quantized=" + quantize(planetModel, docs[docID]));
+ System.out.println(" quantized=" + quantize(planetMax, docs[docID]));
fail = true;
}
}
@@ -1006,7 +1023,7 @@ public class TestGeo3DPointField extends
GeoPoint point1 = new GeoPoint(planetModel, lats[id], lons[id]);
// Quantized point (32 bits per dim):
- GeoPoint point2 = quantize(planetModel, point1);
+ GeoPoint point2 = quantize(planetModel.getMaximumMagnitude(), point1);
if (shape.isWithin(point1) != shape.isWithin(point2)) {
if (VERBOSE) {
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPathTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPathTest.java?rev=1700450&r1=1700449&r2=1700450&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPathTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPathTest.java Tue Sep 1 09:40:50 2015
@@ -166,6 +166,26 @@ public class GeoPathTest {
public void testPathBounds() {
GeoPath c;
LatLonBounds b;
+ XYZBounds xyzb;
+ GeoPoint point;
+ int relationship;
+ GeoArea area;
+
+ c = new GeoPath(PlanetModel.WGS84, 0.7766715171374766);
+ c.addPoint(-0.2751718361148076, -0.7786721269011477);
+ c.addPoint(0.5728375851539309, -1.2700115736820465);
+ c.done();
+ point = new GeoPoint(PlanetModel.WGS84, -0.01580760332365284, -0.03956004622490505);
+ assertTrue(c.isWithin(point));
+ xyzb = new XYZBounds();
+ c.getBounds(xyzb);
+ area = GeoAreaFactory.makeGeoArea(PlanetModel.WGS84,
+ xyzb.getMinimumX(), xyzb.getMaximumX(), xyzb.getMinimumY(), xyzb.getMaximumY(), xyzb.getMinimumZ(), xyzb.getMaximumZ());
+ //System.err.println("minx="+xyzb.getMinimumX()+" maxx="+xyzb.getMaximumX()+" miny="+xyzb.getMinimumY()+" maxy="+xyzb.getMaximumY()+" minz="+xyzb.getMinimumZ()+" maxz="+xyzb.getMaximumZ());
+ //System.err.println("point.x="+point.x+" point.y="+point.y+" point.z="+point.z);
+ relationship = area.getRelationship(c);
+ assertTrue(relationship == GeoArea.WITHIN || relationship == GeoArea.OVERLAPS);
+ assertTrue(area.isWithin(point));
c = new GeoPath(PlanetModel.SPHERE, 0.1);
c.addPoint(-0.3, -0.3);