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/14 20:17:02 UTC
svn commit: r1695950 - in
/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d:
GeoAreaFactory.java GeoPoint.java dXdYdZSolid.java
Author: mikemccand
Date: Fri Aug 14 18:17:02 2015
New Revision: 1695950
URL: http://svn.apache.org/r1695950
Log:
LUCENE-6699: more degenerate solids
Modified:
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoAreaFactory.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoPoint.java
lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXdYdZSolid.java
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoAreaFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoAreaFactory.java?rev=1695950&r1=1695949&r2=1695950&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoAreaFactory.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoAreaFactory.java Fri Aug 14 18:17:02 2015
@@ -53,32 +53,28 @@ public class GeoAreaFactory {
if (Math.abs(maxX - minX) < Vector.MINIMUM_RESOLUTION) {
if (Math.abs(maxY - minY) < Vector.MINIMUM_RESOLUTION) {
if (Math.abs(maxZ - minZ) < Vector.MINIMUM_RESOLUTION) {
- return new dXdYdZSolid(planetModel, minX, minY, minZ);
+ return new dXdYdZSolid(planetModel, (minX+maxX) * 0.5, (minY+maxY) * 0.5, minZ);
} else {
- // nocommit - more here, degenerate in X and Y
- throw new IllegalArgumentException("degenerate in X,Y");
+ return new dXdYZSolid(planetModel, (minX+maxX) * 0.5, (minY+maxY) * 0.5, minZ, maxZ);
}
} else {
if (Math.abs(maxZ - minZ) < Vector.MINIMUM_RESOLUTION) {
- // nocommit - more here, degenerate in X and Z
- throw new IllegalArgumentException("degenerate in X,Z");
+ return new dXYdZSolid(planetModel, (minX+maxX) * 0.5, minY, maxY, (minZ+maxZ) * 0.5);
} else {
- return new dXYZSolid(planetModel, minX, minY, maxY, minZ, maxZ);
+ return new dXYZSolid(planetModel, (minX+maxX) * 0.5, minY, maxY, minZ, maxZ);
}
}
}
if (Math.abs(maxY - minY) < Vector.MINIMUM_RESOLUTION) {
if (Math.abs(maxZ - minZ) < Vector.MINIMUM_RESOLUTION) {
- // nocommit - more here, degenerate in Y and Z
- throw new IllegalArgumentException("degenerate in Y,Z");
+ return new XdYdZSolid(planetModel, minX, maxX, (minY+maxY) * 0.5, (minZ+maxZ) * 0.5);
} else {
- return new XdYZSolid(planetModel, minX, maxX, minY, minZ, maxZ);
+ return new XdYZSolid(planetModel, minX, maxX, (minY+maxY) * 0.5, minZ, maxZ);
}
}
if (Math.abs(maxZ - minZ) < Vector.MINIMUM_RESOLUTION) {
- return new XYdZSolid(planetModel, minX, maxX, minY, maxY, minZ);
+ return new XYdZSolid(planetModel, minX, maxX, minY, maxY, (minZ+maxZ) * 0.5);
}
- // nocommit - handle degenerate cases explicitly
return new XYZSolid(planetModel, minX, maxX, minY, maxY, minZ, maxZ);
}
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoPoint.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoPoint.java?rev=1695950&r1=1695949&r2=1695950&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoPoint.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/GeoPoint.java Fri Aug 14 18:17:02 2015
@@ -171,4 +171,16 @@ public class GeoPoint extends Vector {
}
return mag;
}
+
+ /** Compute whether point matches another.
+ *@param x is the x value
+ *@param y is the y value
+ *@param z is the z value
+ *@return true if the same.
+ */
+ public boolean isIdentical(final double x, final double y, final double z) {
+ return Math.abs(this.x - x) < MINIMUM_RESOLUTION &&
+ Math.abs(this.y - y) < MINIMUM_RESOLUTION &&
+ Math.abs(this.z - z) < MINIMUM_RESOLUTION;
+ }
}
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXdYdZSolid.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXdYdZSolid.java?rev=1695950&r1=1695949&r2=1695950&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXdYdZSolid.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/dXdYdZSolid.java Fri Aug 14 18:17:02 2015
@@ -69,9 +69,7 @@ public class dXdYdZSolid extends BaseXYZ
if (!isOnSurface) {
return false;
}
- return Math.abs(thePoint.x - x) < Vector.MINIMUM_RESOLUTION &&
- Math.abs(thePoint.y - y) < Vector.MINIMUM_RESOLUTION &&
- Math.abs(thePoint.z - z) < Vector.MINIMUM_RESOLUTION;
+ return thePoint.isIdentical(x,y,z);
}
@Override