Skip to content

Apache Lucene open-source search software

LUCENE-7153: remove extra PIP copy, this is in Polygon.java now

Robert Muircc75be53f9b3
diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointInPolygonQueryImpl.java b/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointInPolygonQueryImpl.java
index d499a47e72d..20c90785b63 100644
--- a/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointInPolygonQueryImpl.java
+++ b/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointInPolygonQueryImpl.java
@@ -77,7 +77,7 @@ final class GeoPointInPolygonQueryImpl extends GeoPointInBBoxQueryImpl {
* {@link org.apache.lucene.spatial.geopoint.search.GeoPointTermsEnum#accept} method is called to match
* encoded terms that fall within the bounding box of the polygon. Those documents that pass the initial
* bounding box filter are then compared to the provided polygon using the
- * {@link org.apache.lucene.spatial.util.GeoRelationUtils#pointInPolygon} method.
+ * {@link Polygon#contains(Polygon[], double, double)} method.
*/
@Override
protected boolean postFilter(final double lat, final double lon) {
diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/util/GeoRelationUtils.java b/lucene/spatial/src/java/org/apache/lucene/spatial/util/GeoRelationUtils.java
index 50f94465a80..a54a304de65 100644
--- a/lucene/spatial/src/java/org/apache/lucene/spatial/util/GeoRelationUtils.java
+++ b/lucene/spatial/src/java/org/apache/lucene/spatial/util/GeoRelationUtils.java
@@ -36,33 +36,6 @@ public class GeoRelationUtils {
return lat >= minLat && lat <= maxLat && lon >= minLon && lon <= maxLon;
}
- /**
- * simple even-odd point in polygon computation
- * 1. Determine if point is contained in the longitudinal range
- * 2. Determine whether point crosses the edge by computing the latitudinal delta
- * between the end-point of a parallel vector (originating at the point) and the
- * y-component of the edge sink
- *
- * NOTE: Requires polygon point (x,y) order either clockwise or counter-clockwise
- */
- public static boolean pointInPolygon(double[] polyLats, double[] polyLons, double lat, double lon) {
- assert polyLats.length == polyLons.length;
- boolean inPoly = false;
- /**
- * Note: This is using a euclidean coordinate system which could result in
- * upwards of 110KM error at the equator.
- * TODO convert coordinates to cylindrical projection (e.g. mercator)
- */
- for (int i = 1; i < polyLats.length; i++) {
- if (polyLons[i] <= lon && polyLons[i-1] >= lon || polyLons[i-1] <= lon && polyLons[i] >= lon) {
- if (polyLats[i] + (lon - polyLons[i]) / (polyLons[i-1] - polyLons[i]) * (polyLats[i-1] - polyLats[i]) <= lat) {
- inPoly = !inPoly;
- }
- }
- }
- return inPoly;
- }
-
/////////////////////////
// Rectangle relations
/////////////////////////