refactor(compactor): deduplicate Push — PushDirection delegates to Vector overload

Also fix missing using for FillHelpers in FillLinear and FillExtents,
and update callers (CompactorTests, PatternTileForm) for the new
Vector parameter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-18 20:23:50 -04:00
parent b009f195be
commit 9012a9fc1c
5 changed files with 26 additions and 181 deletions
+4 -2
View File
@@ -213,12 +213,14 @@ namespace OpenNest.Forms
if (System.Math.Sqrt(dx * dx + dy * dy) < 0.01)
continue;
var angle = System.Math.Atan2(dy, dx);
var direction = new Vector(dx, dy);
var len = System.Math.Sqrt(dx * dx + dy * dy);
if (len > 0) direction = new Vector(dx / len, dy / len);
var single = new List<Part> { part };
var obstacles = parts.Where(p => p != part).ToList();
totalMoved += Compactor.Push(single, obstacles,
syntheticWorkArea, spacing, angle);
syntheticWorkArea, spacing, direction);
}
if (totalMoved < 0.01)