From e74ce70bcd4b9b0e12744dd6aeb20545f5bf88a0 Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Thu, 26 Jan 2023 11:48:01 -0500 Subject: [PATCH] make logic more clear --- .../main/java/com/onthegomap/planetiler/geo/GeoUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/GeoUtils.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/GeoUtils.java index cd1fc2fb..f656251c 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/GeoUtils.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/geo/GeoUtils.java @@ -451,16 +451,16 @@ public class GeoUtils { // but, we want to allow for rounding errors and small concavities relative to the overall shape // so track the largest positive and negative threshold for triangle area and compare them once we // have enough points - boolean check = i >= minPointsToCheck; + boolean extendedBounds = false; if (z < 0 && absZ > negZ) { negZ = absZ; + extendedBounds = true; } else if (z > 0 && absZ > posZ) { posZ = absZ; - } else if (i > minPointsToCheck) { // always check at i=minPointsToCheck - check = false; + extendedBounds = true; } - if (check) { + if (i == minPointsToCheck || (i > minPointsToCheck && extendedBounds)) { double ratio = negZ < posZ ? negZ / posZ : posZ / negZ; if (ratio > threshold) { return false;