feat: engine-specific TrimAxis and rename ShrinkAxis.Height to Length

Make quantity trimming direction-aware: DefaultNestEngine uses TrimAxis
(virtual property on NestEngineBase) so HorizontalRemnantEngine removes
topmost parts instead of rightmost. Rename ShrinkAxis.Height → Length
for consistency with Width/Length naming used throughout the codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-22 19:43:29 -04:00
parent 2f19f47a85
commit 07d6f08e8b
6 changed files with 14 additions and 10 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ using System.Threading;
namespace OpenNest.Engine.Fill
{
public enum ShrinkAxis { Width, Height }
public enum ShrinkAxis { Width, Length }
public class ShrinkResult
{
@@ -101,7 +101,7 @@ namespace OpenNest.Engine.Fill
if (bbox.Width <= 0 || bbox.Length <= 0)
return box;
var maxDim = axis == ShrinkAxis.Height ? box.Length : box.Width;
var maxDim = axis == ShrinkAxis.Length ? box.Length : box.Width;
// Use FillBestFit for a fast, accurate rectangle count on the full box.
var bin = new Bin { Size = new Size(box.Width, box.Length) };
@@ -121,7 +121,7 @@ namespace OpenNest.Engine.Fill
if (estimate <= 0 || estimate >= maxDim)
return box;
return axis == ShrinkAxis.Height
return axis == ShrinkAxis.Length
? new Box(box.X, box.Y, box.Width, estimate)
: new Box(box.X, box.Y, estimate, box.Length);
}