Move math utilities to OpenNest.Math namespace
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.RectanglePacking
|
||||
{
|
||||
@@ -45,8 +46,8 @@ namespace OpenNest.RectanglePacking
|
||||
if (!BestCombination.FindFrom2(item.Width, item.Height, bin.Width, out normalColumns, out rotateColumns))
|
||||
return bin;
|
||||
|
||||
var normalRows = (int)Math.Floor((bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var rotateRows = (int)Math.Floor((bin.Height + Tolerance.Epsilon) / item.Width);
|
||||
var normalRows = (int)System.Math.Floor((bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var rotateRows = (int)System.Math.Floor((bin.Height + Tolerance.Epsilon) / item.Width);
|
||||
|
||||
item.Location = bin.Location;
|
||||
|
||||
@@ -70,8 +71,8 @@ namespace OpenNest.RectanglePacking
|
||||
if (!BestCombination.FindFrom2(item.Height, item.Width, Bin.Height, out normalRows, out rotateRows))
|
||||
return bin;
|
||||
|
||||
var normalColumns = (int)Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
var rotateColumns = (int)Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Height);
|
||||
var normalColumns = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
var rotateColumns = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Height);
|
||||
|
||||
item.Location = bin.Location;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.RectanglePacking
|
||||
{
|
||||
@@ -13,8 +14,8 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
public override void Fill(Item item)
|
||||
{
|
||||
var ycount = (int)Math.Floor((Bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var xcount = (int)Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
var ycount = (int)System.Math.Floor((Bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var xcount = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
var count = ycount * xcount;
|
||||
|
||||
for (int i = 0; i < xcount; i++)
|
||||
@@ -35,8 +36,8 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
public override void Fill(Item item, int maxCount)
|
||||
{
|
||||
var ycount = (int)Math.Floor((Bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var xcount = (int)Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
var ycount = (int)System.Math.Floor((Bin.Height + Tolerance.Epsilon) / item.Height);
|
||||
var xcount = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
|
||||
var count = ycount * xcount;
|
||||
|
||||
if (count <= maxCount)
|
||||
@@ -50,13 +51,13 @@ namespace OpenNest.RectanglePacking
|
||||
|
||||
if (NestDirection == NestDirection.Vertical)
|
||||
{
|
||||
columns = (int)Math.Ceiling((double)maxCount / ycount);
|
||||
rows = (int)Math.Ceiling((double)maxCount / columns);
|
||||
columns = (int)System.Math.Ceiling((double)maxCount / ycount);
|
||||
rows = (int)System.Math.Ceiling((double)maxCount / columns);
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = (int)Math.Ceiling((double)maxCount / xcount);
|
||||
columns = (int)Math.Ceiling((double)maxCount / rows);
|
||||
rows = (int)System.Math.Ceiling((double)maxCount / xcount);
|
||||
columns = (int)System.Math.Ceiling((double)maxCount / rows);
|
||||
}
|
||||
|
||||
if (item.Width > item.Height)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.RectanglePacking
|
||||
{
|
||||
internal class FillSameRotation : FillEngine
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.RectanglePacking
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.RectanglePacking
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user