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

View File

@@ -109,8 +109,9 @@ namespace OpenNest.Tests
var moving = new List<Part> { part };
var obstacles = new List<Part>();
// angle = π = push left
var distance = Compactor.Push(moving, obstacles, workArea, 0, System.Math.PI);
// direction = left
var direction = new Vector(System.Math.Cos(System.Math.PI), System.Math.Sin(System.Math.PI));
var distance = Compactor.Push(moving, obstacles, workArea, 0, direction);
Assert.True(distance > 0);
Assert.True(part.BoundingBox.Left < 1);
@@ -124,8 +125,10 @@ namespace OpenNest.Tests
var moving = new List<Part> { part };
var obstacles = new List<Part>();
// angle = 3π/2 = push down
var distance = Compactor.Push(moving, obstacles, workArea, 0, 3 * System.Math.PI / 2);
// direction = down
var angle = 3 * System.Math.PI / 2;
var direction = new Vector(System.Math.Cos(angle), System.Math.Sin(angle));
var distance = Compactor.Push(moving, obstacles, workArea, 0, direction);
Assert.True(distance > 0);
Assert.True(part.BoundingBox.Bottom < 1);