refactor: rename Size.Height to Size.Length across codebase
"Length" is more natural than "height" for flat plate materials. Renames the field on OpenNest.Geometry.Size, Box.Height property, and all references across 38 files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ namespace OpenNest.RectanglePacking
|
||||
};
|
||||
|
||||
bin.Width += partSpacing;
|
||||
bin.Height += partSpacing;
|
||||
bin.Length += partSpacing;
|
||||
|
||||
return bin;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace OpenNest.RectanglePacking
|
||||
var box = item.Drawing.Program.BoundingBox();
|
||||
|
||||
box.Width += partSpacing;
|
||||
box.Height += partSpacing;
|
||||
box.Length += partSpacing;
|
||||
|
||||
return new Item
|
||||
{
|
||||
|
||||
@@ -44,11 +44,11 @@ namespace OpenNest.RectanglePacking
|
||||
int normalColumns = 0;
|
||||
int rotateColumns = 0;
|
||||
|
||||
if (!BestCombination.FindFrom2(item.Width, item.Height, bin.Width, out normalColumns, out rotateColumns))
|
||||
if (!BestCombination.FindFrom2(item.Width, item.Length, bin.Width, out normalColumns, out rotateColumns))
|
||||
return bin;
|
||||
|
||||
var normalRows = (int)System.Math.Floor((bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var rotateRows = (int)System.Math.Floor((bin.Height + Tolerance.Epsilon) / item.Width);
|
||||
var normalRows = (int)System.Math.Floor((bin.Length + Tolerance.Epsilon) / item.Length);
|
||||
var rotateRows = (int)System.Math.Floor((bin.Length + Tolerance.Epsilon) / item.Width);
|
||||
|
||||
item.Location = bin.Location;
|
||||
|
||||
@@ -69,17 +69,17 @@ namespace OpenNest.RectanglePacking
|
||||
int normalRows = 0;
|
||||
int rotateRows = 0;
|
||||
|
||||
if (!BestCombination.FindFrom2(item.Height, item.Width, Bin.Height, out normalRows, out rotateRows))
|
||||
if (!BestCombination.FindFrom2(item.Length, item.Width, Bin.Length, out normalRows, out rotateRows))
|
||||
return bin;
|
||||
|
||||
var normalColumns = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
var rotateColumns = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Height);
|
||||
var rotateColumns = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Length);
|
||||
|
||||
item.Location = bin.Location;
|
||||
|
||||
bin.Items.AddRange(FillGrid(item, normalRows, normalColumns, int.MaxValue));
|
||||
|
||||
item.Location.Y += item.Height * normalRows;
|
||||
item.Location.Y += item.Length * normalRows;
|
||||
item.Rotate();
|
||||
|
||||
bin.Items.AddRange(FillGrid(item, rotateRows, rotateColumns, int.MaxValue));
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenNest.RectanglePacking
|
||||
for (var j = 0; j < innerCount; j++)
|
||||
{
|
||||
var x = (columnMajor ? i : j) * item.Width + item.X;
|
||||
var y = (columnMajor ? j : i) * item.Height + item.Y;
|
||||
var y = (columnMajor ? j : i) * item.Length + item.Y;
|
||||
|
||||
var clone = item.Clone() as Item;
|
||||
clone.Location = new Vector(x, y);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
public override void Fill(Item item)
|
||||
{
|
||||
var ycount = (int)System.Math.Floor((Bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var ycount = (int)System.Math.Floor((Bin.Length + Tolerance.Epsilon) / item.Length);
|
||||
var xcount = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
|
||||
for (int i = 0; i < xcount; i++)
|
||||
@@ -24,7 +24,7 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
for (int j = 0; j < ycount; j++)
|
||||
{
|
||||
var y = item.Height * j + Bin.Y;
|
||||
var y = item.Length * j + Bin.Y;
|
||||
|
||||
var addedItem = item.Clone() as Item;
|
||||
addedItem.Location = new Vector(x, y);
|
||||
@@ -36,7 +36,7 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
public override void Fill(Item item, int maxCount)
|
||||
{
|
||||
var ycount = (int)System.Math.Floor((Bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var ycount = (int)System.Math.Floor((Bin.Length + Tolerance.Epsilon) / item.Length);
|
||||
var xcount = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
var count = ycount * xcount;
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenNest.RectanglePacking
|
||||
columns = (int)System.Math.Ceiling((double)maxCount / rows);
|
||||
}
|
||||
|
||||
Bin.Items.AddRange(FillGrid(item, rows, columns, maxCount, columnMajor: item.Width > item.Height));
|
||||
Bin.Items.AddRange(FillGrid(item, rows, columns, maxCount, columnMajor: item.Width > item.Length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
public void Rotate()
|
||||
{
|
||||
Generic.Swap(ref Size.Width, ref Size.Height);
|
||||
Generic.Swap(ref Size.Width, ref Size.Length);
|
||||
IsRotated = !IsRotated;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenNest.RectanglePacking
|
||||
double minX = items[0].X;
|
||||
double minY = items[0].Y;
|
||||
double maxX = items[0].X + items[0].Width;
|
||||
double maxY = items[0].Y + items[0].Height;
|
||||
double maxY = items[0].Y + items[0].Length;
|
||||
|
||||
foreach (var box in items)
|
||||
{
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
public override void Pack(List<Item> items)
|
||||
{
|
||||
items = items.OrderBy(i => -i.Height).ToList();
|
||||
items = items.OrderBy(i => -i.Length).ToList();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.Height > Bin.Height)
|
||||
if (item.Length > Bin.Length)
|
||||
continue;
|
||||
|
||||
var level = FindLevel(item);
|
||||
@@ -36,7 +36,7 @@ namespace OpenNest.RectanglePacking
|
||||
{
|
||||
foreach (var level in levels)
|
||||
{
|
||||
if (level.Height < item.Height)
|
||||
if (level.Height < item.Length)
|
||||
continue;
|
||||
|
||||
if (level.RemainingWidth < item.Width)
|
||||
@@ -58,12 +58,12 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
var remaining = Bin.Top - y;
|
||||
|
||||
if (remaining < item.Height)
|
||||
if (remaining < item.Length)
|
||||
return null;
|
||||
|
||||
var level = new Level(Bin);
|
||||
level.Y = y;
|
||||
level.Height = item.Height;
|
||||
level.Height = item.Length;
|
||||
|
||||
levels.Add(level);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user