You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2019/10/14 18:30:37 UTC

[lucene-solr] branch branch_8x updated: LUCENE-8928: Check that point is inside an edge bounding box when checking if the point belongs to the edge

This is an automated email from the ASF dual-hosted git repository.

ivera pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new e719ea5  LUCENE-8928: Check that point is inside an edge bounding box when checking if the point belongs to the edge
     new 9f02892  Merge branch 'branch_8x' of https://gitbox.apache.org/repos/asf/lucene-solr into branch_8x
e719ea5 is described below

commit e719ea5a42c2b4ec4bec2668056708e910f85e05
Author: iverase <iv...@apache.org>
AuthorDate: Mon Oct 14 20:27:16 2019 +0200

    LUCENE-8928: Check that point is inside an edge bounding box when
    checking if the point belongs to the edge
---
 lucene/core/src/java/org/apache/lucene/geo/EdgeTree.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lucene/core/src/java/org/apache/lucene/geo/EdgeTree.java b/lucene/core/src/java/org/apache/lucene/geo/EdgeTree.java
index 9b83022..e97bd77 100644
--- a/lucene/core/src/java/org/apache/lucene/geo/EdgeTree.java
+++ b/lucene/core/src/java/org/apache/lucene/geo/EdgeTree.java
@@ -119,7 +119,15 @@ public  class EdgeTree {
   /** returns true if the provided x, y point lies on the line */
   protected boolean isPointOnLine(double x, double y) {
     if (y <= max) {
-      if (orient(x1, y1, x2, y2, x, y) == 0) {
+      double a1x = x1;
+      double a1y = y1;
+      double b1x = x2;
+      double b1y = y2;
+      boolean outside = (a1y < y && b1y < y) ||
+          (a1y > y && b1y > y) ||
+          (a1x < x && b1x < x) ||
+          (a1x > x && b1x > x);
+      if (outside == false && orient(a1x, a1y, b1x, b1y, x, y) == 0) {
         return true;
       }
       if (left != null && left.isPointOnLine(x, y)) {