Apache Lucene open-source search software
Return CELL_CROSSES_QUERY when point inside the triangle (#1259)
Ignacio Veraebec456602e4
diff --git a/lucene/core/src/java/org/apache/lucene/geo/Point2D.java b/lucene/core/src/java/org/apache/lucene/geo/Point2D.javaindex f3e79090c88..f858abf9a6e 100644--- a/lucene/core/src/java/org/apache/lucene/geo/Point2D.java+++ b/lucene/core/src/java/org/apache/lucene/geo/Point2D.java@@ -72,7 +72,7 @@ final class Point2D implements Component2D {return contains(ax, ay) ? PointValues.Relation.CELL_INSIDE_QUERY : PointValues.Relation.CELL_OUTSIDE_QUERY;}if (Component2D.pointInTriangle(minX, maxX, minY, maxY, x, y, ax, ay, bx, by, cx, cy)) {- return PointValues.Relation.CELL_INSIDE_QUERY;+ return PointValues.Relation.CELL_CROSSES_QUERY;}return PointValues.Relation.CELL_OUTSIDE_QUERY;}diff --git a/lucene/core/src/test/org/apache/lucene/geo/TestPoint2D.java b/lucene/core/src/test/org/apache/lucene/geo/TestPoint2D.javaindex d398a4f7a0b..06fdb0a6305 100644--- a/lucene/core/src/test/org/apache/lucene/geo/TestPoint2D.java+++ b/lucene/core/src/test/org/apache/lucene/geo/TestPoint2D.java@@ -43,7 +43,7 @@ public class TestPoint2D extends LuceneTestCase {double by = 0;double cx = 0;double cy = 1;- assertEquals(Relation.CELL_INSIDE_QUERY, point2D.relateTriangle(ax, ay, bx, by , cx, cy));+ assertEquals(Relation.CELL_CROSSES_QUERY, point2D.relateTriangle(ax, ay, bx, by , cx, cy));assertEquals(Component2D.WithinRelation.CANDIDATE,point2D.withinTriangle(ax, ay, random().nextBoolean(), bx, by, random().nextBoolean(), cx, cy, random().nextBoolean()));}