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 # Populate grid with coordinates in a regular grid
for y_index in range(y_count): # rows for y_index in range(y_count): # rows
coords.append([]) row = [
for x_index in range(x_count): # cols (starting_pos[0] + x_index * dx, starting_pos[1] + y_index * dy)
# Create a coordinate tuple for x_index in range(x_count)
coord = ( ]
starting_pos[0] + x_index * dx, if style == "snake" and y_index % 2 == 1:
starting_pos[1] + y_index * dy, row.reverse()
) coords.append(row)
# 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()
return coords return coords