All 132 OpenNest.Engine source files now declare namespaces matching their nested directories: Jobs/, Jobs/Placement/, Jobs/Adapters/, Fill/, RectanglePacking/, CirclePacking/, and engine-root types moved from 'OpenNest' to 'OpenNest.Engine'. RootNamespace updated accordingly. Consumers (Api, Console, Mcp, Benchmark, Training, desktop app, tests) gained the explicit usings the move requires; CLAUDE.md updated.
66 lines
2.0 KiB
C#
66 lines
2.0 KiB
C#
using OpenNest.Geometry;
|
|
using OpenNest.Math;
|
|
|
|
namespace OpenNest.Engine.RectanglePacking
|
|
{
|
|
internal class FillNoRotation : FillEngine
|
|
{
|
|
public FillNoRotation(Bin bin)
|
|
: base(bin) { }
|
|
|
|
public NestDirection NestDirection { get; set; }
|
|
|
|
public override void Fill(Item item)
|
|
{
|
|
var ycount = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
|
var xcount = (int)System.Math.Floor((Bin.Length + Tolerance.Epsilon) / item.Length);
|
|
|
|
for (int i = 0; i < xcount; i++)
|
|
{
|
|
var x = item.Length * i + Bin.X;
|
|
|
|
for (int j = 0; j < ycount; j++)
|
|
{
|
|
var y = item.Width * j + Bin.Y;
|
|
|
|
var addedItem = item.Clone() as Item;
|
|
addedItem.Location = new Vector(x, y);
|
|
|
|
Bin.Items.Add(addedItem);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void Fill(Item item, int maxCount)
|
|
{
|
|
var ycount = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
|
var xcount = (int)System.Math.Floor((Bin.Length + Tolerance.Epsilon) / item.Length);
|
|
var count = ycount * xcount;
|
|
|
|
if (count <= maxCount)
|
|
{
|
|
Fill(item);
|
|
return;
|
|
}
|
|
|
|
var columns = 0;
|
|
var rows = 0;
|
|
|
|
if (NestDirection == NestDirection.Vertical)
|
|
{
|
|
columns = (int)System.Math.Ceiling((double)maxCount / ycount);
|
|
rows = (int)System.Math.Ceiling((double)maxCount / columns);
|
|
}
|
|
else
|
|
{
|
|
rows = (int)System.Math.Ceiling((double)maxCount / xcount);
|
|
columns = (int)System.Math.Ceiling((double)maxCount / rows);
|
|
}
|
|
|
|
Bin.Items.AddRange(
|
|
FillGrid(item, rows, columns, maxCount, columnMajor: item.Width > item.Length)
|
|
);
|
|
}
|
|
}
|
|
}
|