fix(bestfit): drop saved pair sets whose canonical frame changed

Saved best-fit pairs are in the drawing's canonical frame, but the canonical
angle is recomputed on load and was not saved with the set. When that
computation changes (RotatingCalipers checking every hull edge, marks no
longer counted as material), old pairs were replayed in a turned frame and
could overlap.

Each saved set now records canonicalAngle, and BestFitCacheStore.Import
skips sets whose angle no longer matches the recomputed one (1e-9 rad,
modulo a full turn). Sets from older files have no angle and are dropped;
their pairs are recomputed when next needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-10-20 22:04:23 -04:00
1 parent f901840ed0
commit 0ca4e64189
9 files changed
+213 -17

No files matched your search

+1
View File
@@ -726,6 +726,7 @@ namespace OpenNest.IO
public double PlateWidth { get; init; }
public double PlateHeight { get; init; }
public double Spacing { get; init; }
public double? CanonicalAngle { get; init; }
public List<BestFitResultDto> Results { get; init; } = new();
}
+2 -1
View File
@@ -465,7 +465,8 @@ namespace OpenNest.IO
r.Reason,
r.TrueArea,
r.HullAngles
)).ToList()
)).ToList(),
set.CanonicalAngle
);
/// <summary>
+1
View File
@@ -460,6 +460,7 @@ namespace OpenNest.IO
PlateWidth = set.PlateWidth,
PlateHeight = set.PlateHeight,
Spacing = set.Spacing,
CanonicalAngle = set.CanonicalAngle,
Results = set
.Results.Select(r => new BestFitResultDto
{