refactor: replace VPattern/HPattern with unified FillGrid method

Consolidates two nearly-identical grid generation methods into a single
FillGrid method with a columnMajor parameter. Fixes bug in HPattern
where inner loop used rows instead of columns, and fixes FillNoRotation
silently discarding results by not adding them to Bin.Items.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 21:27:11 -05:00
parent 062981ebe9
commit d3704378c2
3 changed files with 16 additions and 57 deletions

View File

@@ -61,10 +61,7 @@ namespace OpenNest.RectanglePacking
columns = (int)System.Math.Ceiling((double)maxCount / rows);
}
if (item.Width > item.Height)
VPattern(item, rows, columns, maxCount);
else
HPattern(item, rows, columns, maxCount);
Bin.Items.AddRange(FillGrid(item, rows, columns, maxCount, columnMajor: item.Width > item.Height));
}
}
}