diff --git a/src/tools/grid.py b/src/tools/grid.py index 0cd5fef..777c300 100644 --- a/src/tools/grid.py +++ b/src/tools/grid.py @@ -204,15 +204,18 @@ class Grid: def isCorner(self, pos: Coordinate) -> bool: return pos in self.getCorners() - def isWithinBoundaries(self, pos: Coordinate) -> bool: + def isWithinBoundaries(self, pos: Coordinate, pad: int = 0) -> bool: if self.mode3D: return ( - self.minX <= pos.x <= self.maxX - and self.minY <= pos.y <= self.maxY - and self.minZ <= pos.z <= self.maxZ + self.minX + pad <= pos.x <= self.maxX - pad + and self.minY + pad <= pos.y <= self.maxY - pad + and self.minZ + pad <= pos.z <= self.maxZ - pad ) else: - return self.minX <= pos.x <= self.maxX and self.minY <= pos.y <= self.maxY + return ( + self.minX + pad <= pos.x <= self.maxX - pad + and self.minY + pad <= pos.y <= self.maxY - pad + ) def getActiveCells( self, x: int = None, y: int = None, z: int = None