From 7c7a7e916c09e4076c07d10cbd9c56e153d01c46 Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 14 Oct 2024 17:24:49 -0700 Subject: [PATCH] Fix offset handling in polygon normalized_form() --- masque/shapes/polygon.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/masque/shapes/polygon.py b/masque/shapes/polygon.py index 1e0352f..1f72ea2 100644 --- a/masque/shapes/polygon.py +++ b/masque/shapes/polygon.py @@ -379,8 +379,9 @@ class Polygon(Shape): def normalized_form(self, norm_value: float) -> normalized_shape_tuple: # Note: this function is going to be pretty slow for many-vertexed polygons, relative to # other shapes - offset = self.vertices.mean(axis=0) + self.offset - zeroed_vertices = self.vertices - offset + meanv = self.vertices.mean(axis=0) + zeroed_vertices = self.vertices - meanv + offset = meanv + self.offset scale = zeroed_vertices.std() normed_vertices = zeroed_vertices / scale