From f42a4ce6de0deefc6069cb5a80c9ad9016ddbb51 Mon Sep 17 00:00:00 2001 From: "Egli Adrian (IT-SCI-API-PFI)" <adrian.egli@sbb.ch> Date: Mon, 17 Jun 2019 09:48:56 +0200 Subject: [PATCH] bug fix --- flatland/utils/graphics_pil.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py index 49839287..89068b62 100644 --- a/flatland/utils/graphics_pil.py +++ b/flatland/utils/graphics_pil.py @@ -83,15 +83,12 @@ class PILGL(GraphicsLayer): self.background_grid = np.zeros(shape=(self.width, self.height)) for x in range(self.width): for y in range(self.height): - distance = None + distance = int(np.ceil(np.sqrt(self.width**2.0 + self.height**2.0))) for rc in dTargets: r = rc[1] c = rc[0] d = int(np.floor(np.sqrt((x - r) ** 2 + (y - c) ** 2))) - if distance is None: - distance = d - else: - distance = min(d, distance) + distance = min(d, distance) self.background_grid[x][y] = distance def rgb_s2i(self, sRGB): -- GitLab