Improve tessellator performance by delaying calls to the method #isIntersectingPolygon (#11786)

This commit is contained in:
Ignacio Vera 2022-09-20 07:15:38 +02:00 committed by GitHub
parent accc3bdcfa
commit ecb0ba542b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -98,6 +98,9 @@ Improvements
* GITHUB#11778: Detailed part-of-speech information for particle(조사) and ending(어미) on Nori
is 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 to

View File

@ -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 polygon
boolean 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 */