You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by nk...@apache.org on 2019/04/15 15:52:10 UTC
[lucene-solr] branch master updated: LUCENE-8736: Fix line
detection bug in Polygon2D and Line2D componentRelateTriangle
This is an automated email from the ASF dual-hosted git repository.
nknize pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 8975ae5 LUCENE-8736: Fix line detection bug in Polygon2D and Line2D componentRelateTriangle
8975ae5 is described below
commit 8975ae5954bac2623ecb4b78adb8f08f58f24f9c
Author: Nicholas Knize <nk...@gmail.com>
AuthorDate: Mon Apr 15 10:43:56 2019 -0500
LUCENE-8736: Fix line detection bug in Polygon2D and Line2D componentRelateTriangle
---
lucene/core/src/java/org/apache/lucene/geo/Polygon2D.java | 8 ++------
lucene/sandbox/src/java/org/apache/lucene/geo/Line2D.java | 2 +-
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/geo/Polygon2D.java b/lucene/core/src/java/org/apache/lucene/geo/Polygon2D.java
index c0931b0..7db8287 100644
--- a/lucene/core/src/java/org/apache/lucene/geo/Polygon2D.java
+++ b/lucene/core/src/java/org/apache/lucene/geo/Polygon2D.java
@@ -124,13 +124,9 @@ public final class Polygon2D extends EdgeTree {
}
}
if (ax == bx && bx == cx && ay == by && by == cy) {
- // indexed "triangle" is a point:
- if (Rectangle.containsPoint(ay, ax, minLat, maxLat, minLon, maxLon) == false) {
- return Relation.CELL_OUTSIDE_QUERY;
- }
- // shortcut by checking contains
+ // indexed "triangle" is a point: shortcut by checking contains
return contains(ay, ax) ? Relation.CELL_INSIDE_QUERY : Relation.CELL_OUTSIDE_QUERY;
- } else if (ax == cx && ay == cy) {
+ } else if ((ax == cx && ay == cy) || (bx == cx && by == cy)) {
// indexed "triangle" is a line segment: shortcut by calling appropriate method
return relateIndexedLineSegment(ax, ay, bx, by);
}
diff --git a/lucene/sandbox/src/java/org/apache/lucene/geo/Line2D.java b/lucene/sandbox/src/java/org/apache/lucene/geo/Line2D.java
index 797892e..9f41319 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/geo/Line2D.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/geo/Line2D.java
@@ -57,7 +57,7 @@ public final class Line2D extends EdgeTree {
if (isPointOnLine(tree, ax, ay)) {
return Relation.CELL_INSIDE_QUERY;
}
- } else if (ax == cx && ay == cy) {
+ } else if ((ax == cx && ay == cy) || (bx == cx && by == cy)) {
// indexed "triangle" is a line:
if (tree.crossesLine(ax, ay, bx, by)) {
return Relation.CELL_CROSSES_QUERY;