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:49:32 UTC

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

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 on 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:
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