You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2016/04/01 06:26:11 UTC
lucene-solr:branch_6x: LUCENE-7153: remove extra PIP copy,
this is in Polygon.java now
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 2c0a8ed41 -> 50909527d
LUCENE-7153: remove extra PIP copy, this is in Polygon.java now
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/50909527
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/50909527
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/50909527
Branch: refs/heads/branch_6x
Commit: 50909527d038b7cff1f8dcb31d5343667956b790
Parents: 2c0a8ed
Author: Robert Muir <rm...@apache.org>
Authored: Fri Apr 1 00:23:22 2016 -0400
Committer: Robert Muir <rm...@apache.org>
Committed: Fri Apr 1 00:24:27 2016 -0400
----------------------------------------------------------------------
.../search/GeoPointInPolygonQueryImpl.java | 2 +-
.../lucene/spatial/util/GeoRelationUtils.java | 27 --------------------
2 files changed, 1 insertion(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/50909527/lucene/spatial/src/java/org/apache/lucene/spatial/geopoint/search/GeoPointInPolygonQueryImpl.java
----------------------------------------------------------------------
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 d499a47..20c9078 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) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/50909527/lucene/spatial/src/java/org/apache/lucene/spatial/util/GeoRelationUtils.java
----------------------------------------------------------------------
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 50f9446..a54a304 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
/////////////////////////