Apache Lucene open-source search software
Improve tessellator performance by delaying calls to the method #isIntersectingPolygon (#11786)
Ignacio Veraecb0ba542bfe
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 4d0bf33ecb6..242bac523d7 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -98,6 +98,9 @@ Improvements* GITHUB#11778: Detailed part-of-speech information for particle(조사) and ending(어미) on Noriis now tagged. (Namgyu Kim)+* GITHUB#11785: Improve Tessellator performance by delaying calls to the method+ #isIntersectingPolygon (Ignacio Vera)+Bug Fixes---------------------* GITHUB#11726: Indexing term vectors on large documents could fail due todiff --git a/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java b/lucene/core/src/java/org/apache/lucene/geo/Tessellator.javaindex e93958a96d3..8a3fcc16173 100644--- a/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java+++ b/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java@@ -772,7 +772,6 @@ public final class Tessellator {// a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])if (isVertexEquals(a, b) == false- && isIntersectingPolygon(a, a.getX(), a.getY(), b.getX(), b.getY()) == false&& linesIntersect(a.getX(),a.getY(),@@ -783,7 +782,9 @@ public final class Tessellator {b.getX(),b.getY())&& isLocallyInside(a, b)- && isLocallyInside(b, a)) {+ && isLocallyInside(b, a)+ // this call is expensive so do it last+ && isIntersectingPolygon(a, a.getX(), a.getY(), b.getX(), b.getY()) == false) {// compute edges from polygonboolean abFromPolygon =(a.next == node)@@ -1117,7 +1118,6 @@ public final class Tessellator {}return a.next.idx != b.idx&& a.previous.idx != b.idx- && isIntersectingPolygon(a, a.getX(), a.getY(), b.getX(), b.getY()) == false&& isLocallyInside(a, b)&& isLocallyInside(b, a)&& isLocallyInside(a.previous, b)@@ -1127,7 +1127,9 @@ public final class Tessellator {&& area(a.previous.getX(), a.previous.getY(), a.getX(), a.getY(), b.getX(), b.getY()) != 0&& area(a.getX(), a.getY(), b.getX(), b.getY(), b.next.getX(), b.next.getY()) != 0&& area(a.next.getX(), a.next.getY(), a.getX(), a.getY(), b.getX(), b.getY()) != 0- && area(a.getX(), a.getY(), b.getX(), b.getY(), b.previous.getX(), b.previous.getY()) != 0;+ && area(a.getX(), a.getY(), b.getX(), b.getY(), b.previous.getX(), b.previous.getY()) != 0+ // this call is expensive so do it last+ && isIntersectingPolygon(a, a.getX(), a.getY(), b.getX(), b.getY()) == false;}/** Determine whether the polygon defined between node start and node end is CW */