nknize commented on a change in pull request #771: LUCENE-8620: Update Tessellator logic to label if triangle edges belongs to the original polygon URL: https://github.com/apache/lucene-solr/pull/771#discussion_r321718297
########## File path: lucene/sandbox/src/java/org/apache/lucene/geo/Tessellator.java ########## @@ -590,14 +601,123 @@ private static final boolean splitEarcut(Object polygon, final Node start, final return false; } + /** Computes if edge defined by a and b overlaps with a polygon edge **/ + private static boolean edgeFromPolygon(final Node a, final Node b, final boolean isMorton) { + if (isMorton) { + return mortonEdgeFromPolygon(a, b); + } + Node next = a; + do { + if (pointInLine(next, next.next, a) && pointInLine(next, next.next, b)) { + return next.nextEdgeFromPolygon; + } + if (pointInLine(next, next.previous, a) && pointInLine(next, next.previous, b)) { + return next.previous.nextEdgeFromPolygon; + } + next = next.next; + } while(next != a); + return false; + } + + /** Uses morton code for speed to determine whether or not and edge defined by a and b overlaps with a polygon edge */ + private static final boolean mortonEdgeFromPolygon(final Node a, final Node b) { Review comment: ```suggestion private static final boolean isMortonEdgeFromPolygon(final Node a, final Node b) { ``` ---------------------------------------------------------------- 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