From 0d961ea4ab74259dc4079b14e35d179bf1ec6b07 Mon Sep 17 00:00:00 2001 From: iverase Date: Wed, 20 Apr 2022 14:53:39 +0200 Subject: [PATCH] revert change --- .../org/apache/lucene/geo/Tessellator.java | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java b/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java index 677561ae5f35..3c20c5b54353 100644 --- a/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java +++ b/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java @@ -429,25 +429,20 @@ && pointInEar( p.getX(), p.getY(), hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy)) { tan = Math.abs(hy - p.getY()) / (hx - p.getX()); // tangential if (isVertexEquals(p, connection) && isLocallyInside(p, holeNode)) { - // make sure we are building a CW polygon. This might happen when one or more holes have + // make sure we are building a non-crossing CW polygon. This might happen when one or more holes have // a bridge to a polygon vertex which contains more than one possibility (is a point // with a touching hole). - if (area( - p.previous.getX(), - p.previous.getY(), - p.getX(), - p.getY(), - holeNode.getX(), - holeNode.getY()) - <= 0 - && area( - holeNode.previous.getX(), - holeNode.previous.getY(), - holeNode.getX(), - holeNode.getY(), - p.getX(), - p.getY()) - <= 0) { + boolean crosses = + GeoUtils.lineCrossesLine( + p.getX(), + p.getY(), + holeNode.getX(), + holeNode.getY(), + connection.next.getX(), + connection.next.getY(), + connection.previous.getX(), + connection.previous.getY()); + if (crosses == false) { connection = p; tanMin = tan; }