You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/04/26 15:41:08 UTC

[GitHub] [lucene-solr] jpountz commented on a change in pull request #652: LUCENE-8775: Tessellator: Improve the election of diagonals when splitting the polygon

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org