feat: use direction-specific engines in StripNestEngine

Height shrink now uses HorizontalRemnantEngine (minimizes Y-extent)
and width shrink uses VerticalRemnantEngine (minimizes X-extent).
IterativeShrinkFiller accepts an optional widthFillFunc so each
shrink axis can use a different fill engine.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-21 23:09:02 -04:00
parent 92b17b2963
commit 07012033c7
2 changed files with 17 additions and 8 deletions

View File

@@ -77,17 +77,23 @@ namespace OpenNest
// Phase 1: Iterative shrink-fill for multi-quantity items.
if (fillItems.Count > 0)
{
// Pass progress through so the UI shows intermediate results
// during the initial BestFitCache computation and fill phases.
Func<NestItem, Box, List<Part>> fillFunc = (ni, b) =>
// Use direction-specific engines: height shrink benefits from
// minimizing Y-extent, width shrink from minimizing X-extent.
Func<NestItem, Box, List<Part>> heightFillFunc = (ni, b) =>
{
var inner = new DefaultNestEngine(Plate);
var inner = new HorizontalRemnantEngine(Plate);
return inner.Fill(ni, b, progress, token);
};
Func<NestItem, Box, List<Part>> widthFillFunc = (ni, b) =>
{
var inner = new VerticalRemnantEngine(Plate);
return inner.Fill(ni, b, progress, token);
};
var shrinkResult = IterativeShrinkFiller.Fill(
fillItems, workArea, fillFunc, Plate.PartSpacing, token,
progress, PlateNumber);
fillItems, workArea, heightFillFunc, Plate.PartSpacing, token,
progress, PlateNumber, widthFillFunc);
allParts.AddRange(shrinkResult.Parts);