Skip to content
Snippets Groups Projects
Commit ffa38868 authored by Florian Schröder's avatar Florian Schröder
Browse files

Refactor grid size calculation for improved accuracy

Switched from using np.round to np.ceil for block size calculation to ensure more accurate grid sizes. Additionally, replaced range with np.arange for consistent step intervals, and ensured rectangle positions use np.round for precise placement.
parent e3a89815
No related branches found
No related tags found
1 merge request!110V1.2.0 changes
Pipeline #59120 passed
......@@ -335,13 +335,13 @@ class Visualizer:
height: The kitchen height.
fixed_counter_pos: Set of counter positions.
"""
block_size = int(np.round(self.grid_size / 2)) # Set the size of the grid block
block_size = int(np.ceil(self.grid_size / 2)) # Set the size of the grid block
if self.reduced_background:
for x_idx, x in enumerate(range(0, width, block_size)):
for y_idx, y in enumerate(range(0, height, block_size)):
for x_idx, x in enumerate(np.arange(0, width, self.grid_size / 2)):
for y_idx, y in enumerate(np.arange(0, height, self.grid_size / 2)):
if (x_idx // 2, y_idx // 2) not in fixed_counter_pos:
rect = pygame.Rect(x, y, block_size, block_size)
rect = pygame.Rect(np.round(x), np.round(y), block_size, block_size)
surface.fill(colors[self.config["Kitchen"]["ground_tiles_color"]], rect)
pygame.draw.rect(
surface,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment