Apply suggestions from code review of branch snake-scan

Co-authored-by: Julian Stirling <julian@julianstirling.co.uk>
This commit is contained in:
Joe Knapper 2026-02-09 15:01:23 +00:00 committed by Julian Stirling
parent 7413aa57f8
commit 1c17b27c05

View file

@ -691,20 +691,11 @@ def create_rectangular_scan_path(
# Populate grid with coordinates in a regular grid
for y_index in range(y_count): # rows
coords.append([])
for x_index in range(x_count): # cols
# Create a coordinate tuple
coord = (
starting_pos[0] + x_index * dx,
starting_pos[1] + y_index * dy,
)
# Append coordinate array to position grid
coords[y_index].append(coord)
# If style is snake, reverse every second row
if style == "snake":
for i, line in enumerate(coords):
if i % 2 != 0:
# Reverse the list of coordinates
line.reverse()
row = [
(starting_pos[0] + x_index * dx, starting_pos[1] + y_index * dy)
for x_index in range(x_count)
]
if style == "snake" and y_index % 2 == 1:
row.reverse()
coords.append(row)
return coords