feat: wire IFillComparer through FillHelpers, Linear, and Extents strategies

- FillHelpers.FillPattern gains optional IFillComparer parameter; falls back to FillScore when null
- LinearFillStrategy.Fill replaced with FillWithDirectionPreference + comparer from context.Policy
- ExtentsFillStrategy.Fill replaced with comparer.IsBetter, removing FillScore comparison
- DefaultNestEngine group-fill path resolves Task 6 TODO, passing Comparer to FillPattern

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 12:49:59 -04:00
parent ee83f17afe
commit 24beb8ada1
4 changed files with 27 additions and 42 deletions

View File

@@ -30,7 +30,7 @@ namespace OpenNest.Engine.Strategies
return pattern;
}
public static List<Part> FillPattern(FillLinear engine, List<Part> groupParts, List<double> angles, Box workArea)
public static List<Part> FillPattern(FillLinear engine, List<Part> groupParts, List<double> angles, Box workArea, IFillComparer comparer = null)
{
var results = new ConcurrentBag<(List<Part> Parts, FillScore Score)>();
@@ -55,10 +55,18 @@ namespace OpenNest.Engine.Strategies
foreach (var res in results)
{
if (best == null || res.Score > bestScore)
if (comparer != null)
{
best = res.Parts;
bestScore = res.Score;
if (best == null || comparer.IsBetter(res.Parts, best, workArea))
best = res.Parts;
}
else
{
if (best == null || res.Score > bestScore)
{
best = res.Parts;
bestScore = res.Score;
}
}
}