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:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user