mirror of https://github.com/apache/lucene.git
LUCENE-8746: Call relate line with points in the same order as they
come from the original tessellation.
This commit is contained in:
parent
59548c16d3
commit
b7309899e1
|
@ -156,12 +156,15 @@ public class Polygon2D implements Component2D {
|
||||||
if (ax == bx && bx == cx && ay == by && by == cy) {
|
if (ax == bx && bx == cx && ay == by && by == cy) {
|
||||||
// indexed "triangle" is a point: shortcut by checking contains
|
// indexed "triangle" is a point: shortcut by checking contains
|
||||||
return internalContains(ax, ay) ? Relation.CELL_INSIDE_QUERY : Relation.CELL_OUTSIDE_QUERY;
|
return internalContains(ax, ay) ? Relation.CELL_INSIDE_QUERY : Relation.CELL_OUTSIDE_QUERY;
|
||||||
} else if ((ax == cx && ay == cy) || (bx == cx && by == cy)) {
|
} else if (ax == cx && ay == cy) {
|
||||||
// indexed "triangle" is a line segment: shortcut by calling appropriate method
|
// indexed "triangle" is a line segment: shortcut by calling appropriate method
|
||||||
return relateIndexedLineSegment(minX, maxX, minY, maxY, ax, ay, bx, by);
|
return relateIndexedLineSegment(minX, maxX, minY, maxY, ax, ay, bx, by);
|
||||||
} else if ((ax == bx && ay == by)) {
|
} else if (ax == bx && ay == by) {
|
||||||
// indexed "triangle" is a line segment: shortcut by calling appropriate method
|
// indexed "triangle" is a line segment: shortcut by calling appropriate method
|
||||||
return relateIndexedLineSegment(minX, maxX, minY, maxY, ax, ay, cx, cy);
|
return relateIndexedLineSegment(minX, maxX, minY, maxY, bx, by, cx, cy);
|
||||||
|
} else if (bx == cx && by == cy) {
|
||||||
|
// indexed "triangle" is a line segment: shortcut by calling appropriate method
|
||||||
|
return relateIndexedLineSegment(minX, maxX, minY, maxY, cx, cy, ax, ay);
|
||||||
}
|
}
|
||||||
// indexed "triangle" is a triangle:
|
// indexed "triangle" is a triangle:
|
||||||
return relateIndexedTriangle(minX, maxX, minY, maxY, ax, ay, bx, by, cx, cy);
|
return relateIndexedTriangle(minX, maxX, minY, maxY, ax, ay, bx, by, cx, cy);
|
||||||
|
|
|
@ -107,15 +107,21 @@ public final class Line2D implements Component2D {
|
||||||
if (tree.isPointOnLine(ax, ay)) {
|
if (tree.isPointOnLine(ax, ay)) {
|
||||||
return Relation.CELL_INSIDE_QUERY;
|
return Relation.CELL_INSIDE_QUERY;
|
||||||
}
|
}
|
||||||
} else if ((ax == cx && ay == cy) || (bx == cx && by == cy)) {
|
} else if (ax == cx && ay == cy) {
|
||||||
// indexed "triangle" is a line:
|
// indexed "triangle" is a line:
|
||||||
if (tree.crossesLine(minX, maxX, minY, maxY, ax, ay, bx, by)) {
|
if (tree.crossesLine(minX, maxX, minY, maxY, ax, ay, bx, by)) {
|
||||||
return Relation.CELL_CROSSES_QUERY;
|
return Relation.CELL_CROSSES_QUERY;
|
||||||
}
|
}
|
||||||
return Relation.CELL_OUTSIDE_QUERY;
|
return Relation.CELL_OUTSIDE_QUERY;
|
||||||
} else if ((ax == bx && ay == by)) {
|
} else if (ax == bx && ay == by) {
|
||||||
// indexed "triangle" is a line:
|
// indexed "triangle" is a line:
|
||||||
if (tree.crossesLine(minX, maxX, minY, maxY, ax, ay, cx, cy)) {
|
if (tree.crossesLine(minX, maxX, minY, maxY, bx, by, cx, cy)) {
|
||||||
|
return Relation.CELL_CROSSES_QUERY;
|
||||||
|
}
|
||||||
|
return Relation.CELL_OUTSIDE_QUERY;
|
||||||
|
} else if (bx == cx && by == cy) {
|
||||||
|
// indexed "triangle" is a line:
|
||||||
|
if (tree.crossesLine(minX, maxX, minY, maxY, cx, cy, ax, ay)) {
|
||||||
return Relation.CELL_CROSSES_QUERY;
|
return Relation.CELL_CROSSES_QUERY;
|
||||||
}
|
}
|
||||||
return Relation.CELL_OUTSIDE_QUERY;
|
return Relation.CELL_OUTSIDE_QUERY;
|
||||||
|
|
|
@ -472,7 +472,6 @@ public abstract class BaseShapeEncodingTestCase extends LuceneTestCase {
|
||||||
verifyEncoding(ay, ax, ay, ax, ay, ax);
|
verifyEncoding(ay, ax, ay, ax, ay, ax);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8746")
|
|
||||||
public void testRandomLineEncoding() {
|
public void testRandomLineEncoding() {
|
||||||
double ay = nextY();
|
double ay = nextY();
|
||||||
double ax = nextX();
|
double ax = nextX();
|
||||||
|
|
Loading…
Reference in New Issue