jpountz 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_r278996888
########## 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: Why do we need to look at previous and next nodes? Is it for the case that a vertex is shared by multiple holes, or by a hole and the enclosing polygon? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org