fix(engine): fix FillExtents competition and vertical gap bugs

- FillExtents.Fill reported progress internally which overwrote the UI's
  temporary parts even when a better result (e.g. Pairs with 70 parts)
  won the competition. Added final ReportProgress call in FindBestFill
  and Fill(groupParts) to ensure the UI always shows the actual winner.

- FillExtents vertical copy distance clamp (Math.Max with pairHeight +
  spacing) prevented geometry-aware compaction from ever occurring,
  causing visible gaps between rows. Boundaries are already inflated by
  halfSpacing so the calculated distance is correct; only fall back to
  bounding-box distance on non-positive results.

- PairFiller now sets RemainderPatterns on FillLinear so remainder strips
  get pair-based filling instead of only individual parts (+1 part in
  tight layouts).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-18 07:59:28 -04:00
parent 07465d6f0c
commit 6229e5e49d
3 changed files with 25 additions and 3 deletions

View File

@@ -177,9 +177,13 @@ namespace OpenNest
// startOffset = pairHeight (no extra spacing), copyDist = height - slide.
var copyDist = pairHeight - minSlide;
// Clamp: never let geometry quirks produce a distance smaller than
// the bounding box height (which would overlap).
return System.Math.Max(copyDist, pairHeight + partSpacing);
// Boundaries are inflated by halfSpacing, so the geometry-aware
// distance already guarantees partSpacing gap. Only fall back to
// bounding-box distance if the calculation produced a non-positive value.
if (copyDist <= Tolerance.Epsilon)
return pairHeight + partSpacing;
return copyDist;
}
private static double SlideDistance(