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

This reverts commit e695e29355.
This commit is contained in:
2026-03-18 20:26:14 -04:00
parent e695e29355
commit 62f00055b7
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)