From ad1be4c361a99c730b4b794cfc6db5560efd0729 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Wed, 1 Dec 2021 23:37:02 +0100 Subject: [PATCH] Fix placement of rectangularTriangle(s) That was broken by fcefddca1e5a9b18c92991e7451ef5891f69109f. Turns out the the handling of self.spacing (distance between parts was not handled properly. Resolves: #346 Thanks to Guillaume Collic for reporting! --- boxes/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/boxes/__init__.py b/boxes/__init__.py index 10ecc3d..289f95b 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -1939,15 +1939,15 @@ class Boxes: a = math.atan2(y-r, float(x-r)) alpha = math.degrees(a) - width = x + (edges[-1].spacing()+self.spacing)/math.sin(a) + edges[1].spacing() - height = y + edges[0].spacing() + edges[2].spacing() * math.cos(a) + 2* self.spacing + width = x + (edges[-1].spacing()+self.spacing)/math.sin(a) + edges[1].spacing() + self.spacing + height = y + edges[0].spacing() + edges[2].spacing() * math.cos(a) + 2* self.spacing + self.spacing if num > 1: - width = 2*width - x + r - dx = width - x - edges[1].spacing() - self.spacing - dy = edges[0].spacing() + self.spacing + width = 2*width - x + r - self.spacing + dx = width - x - edges[1].spacing() - self.spacing / 2 + dy = edges[0].spacing() + self.spacing / 2 - overallwidth = width * (num // 2 + num % 2) - overallheight = height + overallwidth = width * (num // 2 + num % 2) - self.spacing + overallheight = height - self.spacing if self.move(overallwidth, overallheight, move, before=True): return @@ -1955,7 +1955,7 @@ class Boxes: if self.debug: self.rectangularHole(width/2., height/2., width, height) - self.moveTo(dx, dy) + self.moveTo(dx - self.spacing / 2, dy - self.spacing / 2) for n in range(num): for i, l in enumerate((x, y)):