refactor(engine): introduce PairFillResult and remove FillRemainingStrip

PairFiller now returns PairFillResult (Parts + BestFits) instead of
using a mutable BestFits property. Extracted EvaluateCandidates,
TryReduceWorkArea, and BuildTilingAngles for clarity. Simplified the
candidate loop by leveraging FillScore comparison semantics.

Removed FillRemainingStrip and all its helpers (FindPlacedEdge,
BuildRemainingStrip, BuildRotationSet, FindBestFill, TryFewerRows,
RemainderPatterns) from FillLinear — these were a major bottleneck in
strip nesting, running expensive fills on undersized remnant strips.
ShrinkFiller + RemnantFiller already handle space optimization, making
the remainder strip fill redundant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-19 15:53:23 -04:00
parent 8bfc13d529
commit e969260f3d
7 changed files with 380 additions and 334 deletions
+8 -10
View File
@@ -24,11 +24,10 @@ public class PairFillerTests
var item = new NestItem { Drawing = MakeRectDrawing(20, 10) };
var workArea = new Box(0, 0, 120, 60);
var parts = filler.Fill(item, workArea);
var result = filler.Fill(item, workArea);
Assert.NotNull(parts);
// Pair filling may or may not find interlocking pairs for rectangles,
// but should return a non-null list.
Assert.NotNull(result.Parts);
Assert.NotNull(result.BestFits);
}
[Fact]
@@ -39,10 +38,10 @@ public class PairFillerTests
var item = new NestItem { Drawing = MakeRectDrawing(20, 20) };
var workArea = new Box(0, 0, 10, 10);
var parts = filler.Fill(item, workArea);
var result = filler.Fill(item, workArea);
Assert.NotNull(parts);
Assert.Empty(parts);
Assert.NotNull(result.Parts);
Assert.Empty(result.Parts);
}
[Fact]
@@ -56,9 +55,8 @@ public class PairFillerTests
var item = new NestItem { Drawing = MakeRectDrawing(20, 10) };
var workArea = new Box(0, 0, 120, 60);
var parts = filler.Fill(item, workArea, token: cts.Token);
var result = filler.Fill(item, workArea, token: cts.Token);
// Should return empty or partial — not throw
Assert.NotNull(parts);
Assert.NotNull(result.Parts);
}
}