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:
2026-03-12 22:01:40 -04:00
parent 7e0edd112a
commit 612b540d9d
38 changed files with 133 additions and 133 deletions
+1 -1
View File
@@ -388,7 +388,7 @@ namespace OpenNest.Geometry
boundingBox.X = minX;
boundingBox.Y = minY;
boundingBox.Width = maxX - minX;
boundingBox.Height = maxY - minY;
boundingBox.Length = maxY - minY;
}
public override Entity OffsetEntity(double distance, OffsetSide side)
+1 -1
View File
@@ -13,7 +13,7 @@ namespace OpenNest.Geometry
double minX = boxes[0].X;
double minY = boxes[0].Y;
double maxX = boxes[0].X + boxes[0].Width;
double maxY = boxes[0].Y + boxes[0].Height;
double maxY = boxes[0].Y + boxes[0].Length;
foreach (var box in boxes)
{
+10 -10
View File
@@ -15,14 +15,14 @@ namespace OpenNest.Geometry
{
Location = new Vector(x, y);
Width = w;
Height = h;
Length = h;
}
public Vector Location;
public Vector Center
{
get { return new Vector(X + Width * 0.5, Y + Height * 0.5); }
get { return new Vector(X + Width * 0.5, Y + Length * 0.5); }
}
public Size Size;
@@ -45,10 +45,10 @@ namespace OpenNest.Geometry
set { Size.Width = value; }
}
public double Height
public double Length
{
get { return Size.Height; }
set { Size.Height = value; }
get { return Size.Length; }
set { Size.Length = value; }
}
public void MoveTo(double x, double y)
@@ -86,7 +86,7 @@ namespace OpenNest.Geometry
public double Top
{
get { return Y + Height; }
get { return Y + Length; }
}
public double Bottom
@@ -96,12 +96,12 @@ namespace OpenNest.Geometry
public double Area()
{
return Width * Height;
return Width * Length;
}
public double Perimeter()
{
return Width * 2 + Height * 2;
return Width * 2 + Length * 2;
}
public bool Intersects(Box box)
@@ -197,12 +197,12 @@ namespace OpenNest.Geometry
public Box Offset(double d)
{
return new Box(X - d, Y - d, Width + d * 2, Height + d * 2);
return new Box(X - d, Y - d, Width + d * 2, Length + d * 2);
}
public override string ToString()
{
return string.Format("[Box: X={0}, Y={1}, Width={2}, Height={3}]", X, Y, Width, Height);
return string.Format("[Box: X={0}, Y={1}, Width={2}, Length={3}]", X, Y, Width, Length);
}
}
}
+2 -2
View File
@@ -23,7 +23,7 @@
var x = large.Left;
var y = large.Bottom;
var w = small.Left - x;
var h = large.Height;
var h = large.Length;
return new Box(x, y, w, h);
}
@@ -49,7 +49,7 @@
var x = small.Right;
var y = large.Bottom;
var w = large.Right - x;
var h = large.Height;
var h = large.Length;
return new Box(x, y, w, h);
}
+1 -1
View File
@@ -263,7 +263,7 @@ namespace OpenNest.Geometry
boundingBox.X = Center.X - Radius;
boundingBox.Y = Center.Y - Radius;
boundingBox.Width = Diameter;
boundingBox.Height = Diameter;
boundingBox.Length = Diameter;
}
public override Entity OffsetEntity(double distance, OffsetSide side)
+2 -2
View File
@@ -381,12 +381,12 @@ namespace OpenNest.Geometry
if (StartPoint.Y < EndPoint.Y)
{
boundingBox.Y = StartPoint.Y;
boundingBox.Height = EndPoint.Y - StartPoint.Y;
boundingBox.Length = EndPoint.Y - StartPoint.Y;
}
else
{
boundingBox.Y = EndPoint.Y;
boundingBox.Height = StartPoint.Y - EndPoint.Y;
boundingBox.Length = StartPoint.Y - EndPoint.Y;
}
}
+1 -1
View File
@@ -312,7 +312,7 @@ namespace OpenNest.Geometry
boundingBox.X = minX;
boundingBox.Y = minY;
boundingBox.Width = maxX - minX;
boundingBox.Height = maxY - minY;
boundingBox.Length = maxY - minY;
}
public override Entity OffsetEntity(double distance, OffsetSide side)
+8 -8
View File
@@ -1,16 +1,16 @@
using System;
using System;
namespace OpenNest.Geometry
{
public struct Size
{
public Size(double width, double height)
public Size(double width, double length)
{
Height = height;
Length = length;
Width = width;
}
public double Height;
public double Length;
public double Width;
@@ -21,10 +21,10 @@ namespace OpenNest.Geometry
if (a.Length > 2)
throw new FormatException("Invalid size format.");
var height = double.Parse(a[0]);
var length = double.Parse(a[0]);
var width = double.Parse(a[1]);
return new Size(width, height);
return new Size(width, length);
}
public static bool TryParse(string s, out Size size)
@@ -44,12 +44,12 @@ namespace OpenNest.Geometry
public override string ToString()
{
return string.Format("{0} x {1}", Height, Width);
return string.Format("{0} x {1}", Length, Width);
}
public string ToString(int decimalPlaces)
{
return string.Format("{0} x {1}", System.Math.Round(Height, decimalPlaces), System.Math.Round(Width, decimalPlaces));
return string.Format("{0} x {1}", System.Math.Round(Length, decimalPlaces), System.Math.Round(Width, decimalPlaces));
}
}
}
+1 -1
View File
@@ -220,7 +220,7 @@ namespace OpenNest
var part = new Part(BaseDrawing, clonedProgram,
location + offset,
new Box(BoundingBox.X + offset.X, BoundingBox.Y + offset.Y,
BoundingBox.Width, BoundingBox.Height));
BoundingBox.Width, BoundingBox.Length));
return part;
}
+23 -23
View File
@@ -117,7 +117,7 @@ namespace OpenNest
{
const double oneAndHalfPI = System.Math.PI * 1.5;
Size = new Size(Size.Height, Size.Width);
Size = new Size(Size.Length, Size.Width);
if (rotationDirection == RotationType.CW)
{
@@ -128,7 +128,7 @@ namespace OpenNest
switch (Quadrant)
{
case 1:
Offset(0, Size.Height);
Offset(0, Size.Length);
break;
case 2:
@@ -136,7 +136,7 @@ namespace OpenNest
break;
case 3:
Offset(0, -Size.Height);
Offset(0, -Size.Length);
break;
case 4:
@@ -165,7 +165,7 @@ namespace OpenNest
break;
case 2:
Offset(0, Size.Height);
Offset(0, Size.Length);
break;
case 3:
@@ -173,7 +173,7 @@ namespace OpenNest
break;
case 4:
Offset(0, -Size.Height);
Offset(0, -Size.Length);
break;
default:
@@ -200,19 +200,19 @@ namespace OpenNest
switch (Quadrant)
{
case 1:
centerpt = new Vector(Size.Width * 0.5, Size.Height * 0.5);
centerpt = new Vector(Size.Width * 0.5, Size.Length * 0.5);
break;
case 2:
centerpt = new Vector(-Size.Width * 0.5, Size.Height * 0.5);
centerpt = new Vector(-Size.Width * 0.5, Size.Length * 0.5);
break;
case 3:
centerpt = new Vector(-Size.Width * 0.5, -Size.Height * 0.5);
centerpt = new Vector(-Size.Width * 0.5, -Size.Length * 0.5);
break;
case 4:
centerpt = new Vector(Size.Width * 0.5, -Size.Height * 0.5);
centerpt = new Vector(Size.Width * 0.5, -Size.Length * 0.5);
break;
default:
@@ -308,12 +308,12 @@ namespace OpenNest
case 3:
plateBox.X = (float)-Size.Width;
plateBox.Y = (float)-Size.Height;
plateBox.Y = (float)-Size.Length;
break;
case 4:
plateBox.X = 0;
plateBox.Y = (float)-Size.Height;
plateBox.Y = (float)-Size.Length;
break;
default:
@@ -321,7 +321,7 @@ namespace OpenNest
}
plateBox.Width = Size.Width;
plateBox.Height = Size.Height;
plateBox.Length = Size.Length;
if (!includeParts)
return plateBox;
@@ -341,7 +341,7 @@ namespace OpenNest
? partsBox.Right - boundingBox.X
: plateBox.Right - boundingBox.X;
boundingBox.Height = partsBox.Top > plateBox.Top
boundingBox.Length = partsBox.Top > plateBox.Top
? partsBox.Top - boundingBox.Y
: plateBox.Top - boundingBox.Y;
@@ -359,7 +359,7 @@ namespace OpenNest
box.X += EdgeSpacing.Left;
box.Y += EdgeSpacing.Bottom;
box.Width -= EdgeSpacing.Left + EdgeSpacing.Right;
box.Height -= EdgeSpacing.Top + EdgeSpacing.Bottom;
box.Length -= EdgeSpacing.Top + EdgeSpacing.Bottom;
return box;
}
@@ -383,28 +383,28 @@ namespace OpenNest
var bounds = Parts.GetBoundingBox();
double width;
double height;
double length;
switch (Quadrant)
{
case 1:
width = System.Math.Abs(bounds.Right) + EdgeSpacing.Right;
height = System.Math.Abs(bounds.Top) + EdgeSpacing.Top;
length = System.Math.Abs(bounds.Top) + EdgeSpacing.Top;
break;
case 2:
width = System.Math.Abs(bounds.Left) + EdgeSpacing.Left;
height = System.Math.Abs(bounds.Top) + EdgeSpacing.Top;
length = System.Math.Abs(bounds.Top) + EdgeSpacing.Top;
break;
case 3:
width = System.Math.Abs(bounds.Left) + EdgeSpacing.Left;
height = System.Math.Abs(bounds.Bottom) + EdgeSpacing.Bottom;
length = System.Math.Abs(bounds.Bottom) + EdgeSpacing.Bottom;
break;
case 4:
width = System.Math.Abs(bounds.Right) + EdgeSpacing.Right;
height = System.Math.Abs(bounds.Bottom) + EdgeSpacing.Bottom;
length = System.Math.Abs(bounds.Bottom) + EdgeSpacing.Bottom;
break;
default:
@@ -413,7 +413,7 @@ namespace OpenNest
Size = new Size(
Helper.RoundUpToNearest(width, roundingFactor),
Helper.RoundUpToNearest(height, roundingFactor));
Helper.RoundUpToNearest(length, roundingFactor));
}
/// <summary>
@@ -422,7 +422,7 @@ namespace OpenNest
/// <returns></returns>
public double Area()
{
return Size.Width * Size.Height;
return Size.Width * Size.Length;
}
/// <summary>
@@ -503,7 +503,7 @@ namespace OpenNest
if (maxRight < work.Right)
{
var strip = new Box(maxRight, work.Bottom, work.Right - maxRight, work.Height);
var strip = new Box(maxRight, work.Bottom, work.Right - maxRight, work.Length);
if (strip.Area() > 1.0)
results.Add(strip);
}
@@ -548,7 +548,7 @@ namespace OpenNest
if (minLeft > work.Left)
{
var strip = new Box(work.Left, work.Bottom, minLeft - work.Left, work.Height);
var strip = new Box(work.Left, work.Bottom, minLeft - work.Left, work.Length);
if (strip.Area() > 1.0)
results.Add(strip);
}