polygonWall: Take all edge type into account

when calculating the extent of the polygon. This is a less than ideal,
worst case estimate. Should be replaced by something a bit smarter that
only looks at the current edge and the space it needs.
This commit is contained in:
Florian Festi 2023-01-01 15:26:07 +01:00
parent 420550b2c4
commit 1875742b8d
1 changed files with 8 additions and 6 deletions

View File

@ -2638,7 +2638,7 @@ class Boxes:
### polygonWall and friends
def _polygonWallExtend(self, borders, edge, close=False):
def _polygonWallExtend(self, borders, edges, close=False):
posx, posy = 0, 0
ext = [ 0.0 ] * 4
angle = 0
@ -2686,10 +2686,12 @@ class Boxes:
posy += borders[i] * math.sin(math.radians(angle))
checkpoint(ext, posx, posy)
ext[0] -= edge.margin()
ext[1] -= edge.margin()
ext[2] += edge.margin()
ext[3] += edge.margin()
margin = max((e.margin() for e in edges))
ext[0] -= margin
ext[1] -= margin
ext[2] += margin
ext[3] += margin
return ext
@ -2713,7 +2715,7 @@ class Boxes:
t = self.thickness # XXX edge.margin()
minx, miny, maxx, maxy = self._polygonWallExtend(borders, edges[0])
minx, miny, maxx, maxy = self._polygonWallExtend(borders, edges)
tw, th = maxx - minx, maxy - miny