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/16 05:21:05 UTC
[lucene-solr] branch master updated: LUCENE-8746: Call relate line
with points in the same order as they come from the original tessellation.
This is an automated email from the ASF dual-hosted git repository.
ivera 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 39fcd90 LUCENE-8746: Call relate line with points in the same order as they come from the original tessellation.
39fcd90 is described below
commit 39fcd907fb38df060f0b74b50e22afba8ae37892
Author: iverase <iv...@apache.org>
AuthorDate: Wed Oct 16 07:20:45 2019 +0200
LUCENE-8746: Call relate line with points in the same order as they
come from the original tessellation.
---
lucene/core/src/java/org/apache/lucene/geo/Polygon2D.java | 9 ++++++---
lucene/sandbox/src/java/org/apache/lucene/geo/Line2D.java | 12 +++++++++---
.../apache/lucene/document/BaseShapeEncodingTestCase.java | 1 -
3 files changed, 15 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 3b06d21..cf06ebd 100644
--- a/lucene/core/src/java/org/apache/lucene/geo/Polygon2D.java
+++ b/lucene/core/src/java/org/apache/lucene/geo/Polygon2D.java
@@ -156,12 +156,15 @@ public class Polygon2D implements Component2D {
if (ax == bx && bx == cx && ay == by && by == cy) {
// indexed "triangle" is a point: shortcut by checking contains
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
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
- 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:
return relateIndexedTriangle(minX, maxX, minY, maxY, ax, ay, bx, by, cx, cy);
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 15c923e..02d1422 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/geo/Line2D.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/geo/Line2D.java
@@ -107,15 +107,21 @@ public final class Line2D implements Component2D {
if (tree.isPointOnLine(ax, ay)) {
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:
if (tree.crossesLine(minX, maxX, minY, maxY, ax, ay, bx, by)) {
return Relation.CELL_CROSSES_QUERY;
}
return Relation.CELL_OUTSIDE_QUERY;
- } else if ((ax == bx && ay == by)) {
+ } else if (ax == bx && ay == by) {
// 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_OUTSIDE_QUERY;
diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/BaseShapeEncodingTestCase.java b/lucene/sandbox/src/test/org/apache/lucene/document/BaseShapeEncodingTestCase.java
index e7642a9..ee71047 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/document/BaseShapeEncodingTestCase.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/document/BaseShapeEncodingTestCase.java
@@ -472,7 +472,6 @@ public abstract class BaseShapeEncodingTestCase extends LuceneTestCase {
verifyEncoding(ay, ax, ay, ax, ay, ax);
}
- @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8746")
public void testRandomLineEncoding() {
double ay = nextY();
double ax = nextX();