From 24bed2a73c386f068c0c9d3092080d56e7513033 Mon Sep 17 00:00:00 2001 From: Fabian Wunsch Date: Mon, 11 Apr 2022 22:31:25 +0200 Subject: [PATCH] Moved log out of loop --- tools/calculate_center.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/calculate_center.py b/tools/calculate_center.py index c220941f..2d1f2027 100644 --- a/tools/calculate_center.py +++ b/tools/calculate_center.py @@ -150,11 +150,13 @@ def polylabel(polygon: Polygon, precision: float=0.5, debug: bool=False): if bbox_cell.min_dist > best_cell.min_dist: best_cell = bbox_cell + threshold: float = log10(cell_size) / 2.0 + num_of_probes = cell_queue.qsize() while not cell_queue.empty(): _, __, cell = cell_queue.get() - if cell.min_dist > best_cell.min_dist or (cell.center_dist < best_cell.center_dist and cell.min_dist > best_cell.min_dist - log10(cell_size) / 2.0): + if cell.min_dist > best_cell.min_dist or (cell.center_dist < best_cell.center_dist and cell.min_dist > best_cell.min_dist - threshold): best_cell = cell if debug: