Fix placement of rectangularTriangle(s)

That was broken by fcefddca1e. Turns out
the the handling of self.spacing (distance between parts was not handled
properly.

Resolves: #346

Thanks to Guillaume Collic for reporting!
This commit is contained in:
Florian Festi 2021-12-01 23:37:02 +01:00
parent 8b791b32b6
commit ad1be4c361
1 changed files with 8 additions and 8 deletions

View File

@ -1939,15 +1939,15 @@ class Boxes:
a = math.atan2(y-r, float(x-r)) a = math.atan2(y-r, float(x-r))
alpha = math.degrees(a) alpha = math.degrees(a)
width = x + (edges[-1].spacing()+self.spacing)/math.sin(a) + edges[1].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 height = y + edges[0].spacing() + edges[2].spacing() * math.cos(a) + 2* self.spacing + self.spacing
if num > 1: if num > 1:
width = 2*width - x + r width = 2*width - x + r - self.spacing
dx = width - x - edges[1].spacing() - self.spacing dx = width - x - edges[1].spacing() - self.spacing / 2
dy = edges[0].spacing() + self.spacing dy = edges[0].spacing() + self.spacing / 2
overallwidth = width * (num // 2 + num % 2) overallwidth = width * (num // 2 + num % 2) - self.spacing
overallheight = height overallheight = height - self.spacing
if self.move(overallwidth, overallheight, move, before=True): if self.move(overallwidth, overallheight, move, before=True):
return return
@ -1955,7 +1955,7 @@ class Boxes:
if self.debug: if self.debug:
self.rectangularHole(width/2., height/2., width, height) 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 n in range(num):
for i, l in enumerate((x, y)): for i, l in enumerate((x, y)):