refactor: extract PlacedPart/SequenceEntry types, add IFP caching

Move PlacedPart to its own file. Replace tuple-based sequences with
SequenceEntry struct for clarity. Add IProgress parameter to
INestOptimizer. Add IFP caching to NfpCache to avoid recomputing
inner fit polygons for the same drawing/rotation/workArea.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-20 14:42:50 -04:00
parent facd07d7de
commit 9411dd0fdd
4 changed files with 65 additions and 2 deletions
+4 -2
View File
@@ -1,5 +1,6 @@
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -11,9 +12,9 @@ namespace OpenNest.Engine.Nfp
public class OptimizationResult
{
/// <summary>
/// The best sequence found: (drawingId, rotation, drawing) tuples in placement order.
/// The best placement sequence found.
/// </summary>
public List<(int drawingId, double rotation, Drawing drawing)> Sequence { get; set; }
public List<SequenceEntry> Sequence { get; set; }
/// <summary>
/// The score achieved by the best sequence.
@@ -34,6 +35,7 @@ namespace OpenNest.Engine.Nfp
{
OptimizationResult Optimize(List<NestItem> items, Box workArea, NfpCache cache,
Dictionary<int, List<double>> candidateRotations,
IProgress<NestProgress> progress = null,
CancellationToken cancellation = default);
}
}