merge: resolve .gitignore conflict, keep both entries
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -57,7 +57,7 @@ namespace OpenNest.Engine.BestFit
|
||||
var combinedBox = ((IEnumerable<IBoundable>)new IBoundable[] { part1, part2 }).GetBoundingBox();
|
||||
bestArea = combinedBox.Area();
|
||||
bestWidth = combinedBox.Width;
|
||||
bestHeight = combinedBox.Height;
|
||||
bestHeight = combinedBox.Length;
|
||||
bestRotation = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,15 +64,15 @@ namespace OpenNest.Engine.BestFit
|
||||
|
||||
if (isHorizontalPush)
|
||||
{
|
||||
perpMin = -(bbox2.Height + spacing);
|
||||
perpMax = bbox1.Height + bbox2.Height + spacing;
|
||||
perpMin = -(bbox2.Length + spacing);
|
||||
perpMax = bbox1.Length + bbox2.Length + spacing;
|
||||
pushStartOffset = bbox1.Width + bbox2.Width + spacing * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
perpMin = -(bbox2.Width + spacing);
|
||||
perpMax = bbox1.Width + bbox2.Width + spacing;
|
||||
pushStartOffset = bbox1.Height + bbox2.Height + spacing * 2;
|
||||
pushStartOffset = bbox1.Length + bbox2.Length + spacing * 2;
|
||||
}
|
||||
|
||||
// Pre-compute part1's offset lines (half-spacing outward)
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace OpenNest.Engine.BestFit.Tiling
|
||||
public TileResult Evaluate(BestFitResult bestFit, Plate plate)
|
||||
{
|
||||
var plateWidth = plate.Size.Width - plate.EdgeSpacing.Left - plate.EdgeSpacing.Right;
|
||||
var plateHeight = plate.Size.Height - plate.EdgeSpacing.Top - plate.EdgeSpacing.Bottom;
|
||||
var plateHeight = plate.Size.Length - plate.EdgeSpacing.Top - plate.EdgeSpacing.Bottom;
|
||||
|
||||
var result1 = TryTile(bestFit, plateWidth, plateHeight, false);
|
||||
var result2 = TryTile(bestFit, plateWidth, plateHeight, true);
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace OpenNest.CirclePacking
|
||||
Bin.Right - item.BoundingBox.Right + Tolerance.Epsilon,
|
||||
Bin.Top - item.BoundingBox.Top + Tolerance.Epsilon);
|
||||
|
||||
var rows = System.Math.Floor((Bin.Height + Tolerance.Epsilon) / (item.Diameter));
|
||||
var rows = System.Math.Floor((Bin.Length + Tolerance.Epsilon) / (item.Diameter));
|
||||
|
||||
var diameter = item.Diameter;
|
||||
var remaining = Bin.Height - diameter * rows;
|
||||
var remaining = Bin.Length - diameter * rows;
|
||||
var radius = diameter * 0.5;
|
||||
|
||||
if (remaining < radius)
|
||||
@@ -47,7 +47,7 @@ namespace OpenNest.CirclePacking
|
||||
}
|
||||
else
|
||||
{
|
||||
var yoffset = (Bin.Height - diameter) / (2 * rows - 1);
|
||||
var yoffset = (Bin.Length - diameter) / (2 * rows - 1);
|
||||
var xoffset = Trigonometry.Base(yoffset, diameter);
|
||||
|
||||
var yodd = Bin.Y + yoffset;
|
||||
|
||||
@@ -71,12 +71,12 @@ namespace OpenNest.CirclePacking
|
||||
Bin.Right - item.BoundingBox.Right + Tolerance.Epsilon,
|
||||
Bin.Top - item.BoundingBox.Top + Tolerance.Epsilon);
|
||||
|
||||
var count = System.Math.Floor((bin.Height + Tolerance.Epsilon) / item.Diameter);
|
||||
var count = System.Math.Floor((bin.Length + Tolerance.Epsilon) / item.Diameter);
|
||||
|
||||
if (count == 0)
|
||||
return bin;
|
||||
|
||||
var yoffset = (bin.Height - item.Diameter) / (count - 1);
|
||||
var yoffset = (bin.Length - item.Diameter) / (count - 1);
|
||||
var xoffset = Trigonometry.Base(yoffset * 0.5, item.Diameter);
|
||||
|
||||
int column = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace OpenNest
|
||||
public FillLinear(Box workArea, double partSpacing)
|
||||
{
|
||||
PartSpacing = partSpacing;
|
||||
WorkArea = new Box(workArea.X, workArea.Y, workArea.Width, workArea.Height);
|
||||
WorkArea = new Box(workArea.X, workArea.Y, workArea.Width, workArea.Length);
|
||||
}
|
||||
|
||||
public Box WorkArea { get; }
|
||||
@@ -34,7 +34,7 @@ namespace OpenNest
|
||||
|
||||
private static double GetDimension(Box box, NestDirection direction)
|
||||
{
|
||||
return direction == NestDirection.Horizontal ? box.Width : box.Height;
|
||||
return direction == NestDirection.Horizontal ? box.Width : box.Length;
|
||||
}
|
||||
|
||||
private static double GetStart(Box box, NestDirection direction)
|
||||
@@ -321,7 +321,7 @@ namespace OpenNest
|
||||
template.Offset(WorkArea.Location - template.BoundingBox.Location);
|
||||
|
||||
if (template.BoundingBox.Width > WorkArea.Width + Tolerance.Epsilon ||
|
||||
template.BoundingBox.Height > WorkArea.Height + Tolerance.Epsilon)
|
||||
template.BoundingBox.Length > WorkArea.Length + Tolerance.Epsilon)
|
||||
return pattern;
|
||||
|
||||
pattern.Parts.Add(template);
|
||||
@@ -472,7 +472,7 @@ namespace OpenNest
|
||||
if (width <= Tolerance.Epsilon)
|
||||
return new List<Part>();
|
||||
|
||||
remainingStrip = new Box(left, WorkArea.Y, width, WorkArea.Height);
|
||||
remainingStrip = new Box(left, WorkArea.Y, width, WorkArea.Length);
|
||||
}
|
||||
|
||||
// Build rotation set: always try cardinal orientations (0° and 90°),
|
||||
@@ -601,7 +601,7 @@ namespace OpenNest
|
||||
var basePattern = pattern.Clone(offset);
|
||||
|
||||
if (basePattern.BoundingBox.Width > WorkArea.Width + Tolerance.Epsilon ||
|
||||
basePattern.BoundingBox.Height > WorkArea.Height + Tolerance.Epsilon)
|
||||
basePattern.BoundingBox.Length > WorkArea.Length + Tolerance.Epsilon)
|
||||
return new List<Part>();
|
||||
|
||||
return FillRecursive(basePattern, primaryAxis, depth: 0);
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenNest
|
||||
if (maxRight < workArea.Right)
|
||||
{
|
||||
var width = workArea.Right - maxRight;
|
||||
var height = workArea.Height;
|
||||
var height = workArea.Length;
|
||||
|
||||
if (System.Math.Min(width, height) >= MinRemnantDimension)
|
||||
largest = System.Math.Max(largest, width * height);
|
||||
|
||||
@@ -70,8 +70,8 @@ namespace OpenNest
|
||||
|
||||
testPart.UpdateBounds();
|
||||
|
||||
var partLongestSide = System.Math.Max(testPart.BoundingBox.Width, testPart.BoundingBox.Height);
|
||||
var workAreaShortSide = System.Math.Min(workArea.Width, workArea.Height);
|
||||
var partLongestSide = System.Math.Max(testPart.BoundingBox.Width, testPart.BoundingBox.Length);
|
||||
var workAreaShortSide = System.Math.Min(workArea.Width, workArea.Length);
|
||||
|
||||
if (workAreaShortSide < partLongestSide)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ namespace OpenNest
|
||||
}
|
||||
|
||||
var bestLinearScore = best != null ? FillScore.Compute(best, workArea) : default;
|
||||
Debug.WriteLine($"[FindBestFill] Linear: {bestLinearScore.Count} parts, density={bestLinearScore.Density:P1} | WorkArea: {workArea.Width:F1}x{workArea.Height:F1} | Angles: {angles.Count}");
|
||||
Debug.WriteLine($"[FindBestFill] Linear: {bestLinearScore.Count} parts, density={bestLinearScore.Density:P1} | WorkArea: {workArea.Width:F1}x{workArea.Length:F1} | Angles: {angles.Count}");
|
||||
|
||||
// Try rectangle best-fit (mixes orientations to fill remnant strips).
|
||||
var rectResult = FillRectangleBestFit(item, workArea);
|
||||
@@ -143,7 +143,7 @@ namespace OpenNest
|
||||
var angles = RotationAnalysis.FindHullEdgeAngles(groupParts);
|
||||
var best = FillPattern(engine, groupParts, angles, workArea);
|
||||
|
||||
Debug.WriteLine($"[Fill(groupParts,Box)] Linear: {best?.Count ?? 0} parts | WorkArea: {workArea.Width:F1}x{workArea.Height:F1}");
|
||||
Debug.WriteLine($"[Fill(groupParts,Box)] Linear: {best?.Count ?? 0} parts | WorkArea: {workArea.Width:F1}x{workArea.Length:F1}");
|
||||
|
||||
if (groupParts.Count == 1)
|
||||
{
|
||||
@@ -213,7 +213,7 @@ namespace OpenNest
|
||||
private List<Part> FillWithPairs(NestItem item, Box workArea)
|
||||
{
|
||||
var bestFits = BestFitCache.GetOrCompute(
|
||||
item.Drawing, Plate.Size.Width, Plate.Size.Height,
|
||||
item.Drawing, Plate.Size.Width, Plate.Size.Length,
|
||||
Plate.PartSpacing);
|
||||
|
||||
var candidates = SelectPairCandidates(bestFits, workArea);
|
||||
@@ -260,8 +260,8 @@ namespace OpenNest
|
||||
var kept = bestFits.Where(r => r.Keep).ToList();
|
||||
var top = kept.Take(50).ToList();
|
||||
|
||||
var workShortSide = System.Math.Min(workArea.Width, workArea.Height);
|
||||
var plateShortSide = System.Math.Min(Plate.Size.Width, Plate.Size.Height);
|
||||
var workShortSide = System.Math.Min(workArea.Width, workArea.Length);
|
||||
var plateShortSide = System.Math.Min(Plate.Size.Width, Plate.Size.Length);
|
||||
|
||||
// When the work area is significantly narrower than the plate,
|
||||
// include all pairs that fit the narrow dimension.
|
||||
@@ -356,7 +356,7 @@ namespace OpenNest
|
||||
|
||||
var refDim = horizontal
|
||||
? sorted.Max(p => p.BoundingBox.Width)
|
||||
: sorted.Max(p => p.BoundingBox.Height);
|
||||
: sorted.Max(p => p.BoundingBox.Length);
|
||||
var gapThreshold = refDim * 0.5;
|
||||
|
||||
var clusters = new List<List<Part>>();
|
||||
@@ -425,7 +425,7 @@ namespace OpenNest
|
||||
if (stripWidth <= 0)
|
||||
return null;
|
||||
|
||||
stripBox = new Box(stripLeft, workArea.Y, stripWidth, workArea.Height);
|
||||
stripBox = new Box(stripLeft, workArea.Y, stripWidth, workArea.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -438,7 +438,7 @@ namespace OpenNest
|
||||
stripBox = new Box(workArea.X, stripBottom, workArea.Width, stripHeight);
|
||||
}
|
||||
|
||||
Debug.WriteLine($"[TryStripRefill] Strip: {stripBox.Width:F1}x{stripBox.Height:F1} at ({stripBox.X:F1},{stripBox.Y:F1})");
|
||||
Debug.WriteLine($"[TryStripRefill] Strip: {stripBox.Width:F1}x{stripBox.Length:F1} at ({stripBox.X:F1},{stripBox.Y:F1})");
|
||||
|
||||
var stripParts = FindBestFill(item, stripBox);
|
||||
|
||||
|
||||
@@ -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