iverase commented on a change in pull request #652: LUCENE-8775: Tessellator:
Improve the election of diagonals when splitting the polygon
URL: https://github.com/apache/lucene-solr/pull/652#discussion_r279005921
##########
File path: lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java
##########
@@ -163,7 +163,19 @@ private static final Node eliminateHoles(final Polygon
polygon, Node outerNode)
// Sort the hole vertices by x coordinate
holeList.sort((Node pNodeA, Node pNodeB) ->
- pNodeA.getX() < pNodeB.getX() ? -1 : pNodeA.getX() == pNodeB.getX() ?
0 : 1);
+ {
+ double diff = pNodeA.getX() - pNodeB.getX();
+ if (diff == 0) {
+ diff = pNodeA.getY() - pNodeB.getY();
+ if (diff == 0) {
+ //same hole node
+ double a = Math.min(pNodeA.previous.getY(), pNodeA.next.getY());
+ double b = Math.min(pNodeB.previous.getY(), pNodeB.next.getY());
+ diff = a - b;
+ }
Review comment:
This is the case when two holes share a vertex and that vertex is the left
most one in each case. We need to order them so the one at the top is bigger
than the one at the bottom.
In oder to do that we use the neighbour points. Probably it is enough to
just use the next point but this is to work even in the case where holes are in
different orientation.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]