mirror of https://github.com/apache/lucene.git
LUCENE-8736: Fix line detection bug in Polygon2D and Line2D componentRelateTriangle
This commit is contained in:
parent
e783207535
commit
8975ae5954
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue