mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-12-04 07:19:24 -05:00
refactor(engine): remove dead code flagged by Roslyn Bridge
Drop the unused Expander.BoxOverlap helper, an unused local in JointCuttingPlanSearch.AutomaticEntries, PairFiller's unread plate field, and parameters nothing reads (BuildStrategies' spacing, RepeatColumns' token, RouteDistance's i/j). NestJobValidator keeps its job parameter: it names the argument in the thrown exceptions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
416f8296a8
commit
347c0e98b8
6 files changed
+7
-19
No files matched your search
@@ -83,7 +83,7 @@ namespace OpenNest.Engine.BestFit
|
||||
private List<BestFitResult> Evaluate(Drawing drawing, double spacing, double stepSize)
|
||||
{
|
||||
PerfCounters.CountFindBestFits();
|
||||
var strategies = BuildStrategies(drawing, spacing);
|
||||
var strategies = BuildStrategies(drawing);
|
||||
|
||||
// Slots in strategy (angle) order, so candidates keep generation order however the
|
||||
// workers finish: the stable area sort then breaks ties the same way on every run.
|
||||
@@ -127,7 +127,7 @@ namespace OpenNest.Engine.BestFit
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private List<IBestFitStrategy> BuildStrategies(Drawing drawing, double spacing)
|
||||
private List<IBestFitStrategy> BuildStrategies(Drawing drawing)
|
||||
{
|
||||
var angles = GetRotationAngles(drawing);
|
||||
var strategies = new List<IBestFitStrategy>();
|
||||
|
||||
@@ -1366,7 +1366,6 @@ internal static class JointCuttingPlanSearch
|
||||
private IReadOnlyList<ContourChoice> AutomaticEntries(Node node, int[] sequence,
|
||||
FixedProgramPlacement source, int contour)
|
||||
{
|
||||
var prepared = source.Prepared!;
|
||||
var arrival = node.RoutePosition - source.Location;
|
||||
// One global->local conversion of target and arrival; geometry is already rotated.
|
||||
Vector? local = LookAheadCenter(node, sequence, source) is { } target
|
||||
|
||||
@@ -1619,8 +1619,6 @@ namespace OpenNest.Engine.Fill
|
||||
clone.Offset(offset);
|
||||
return clone;
|
||||
}
|
||||
|
||||
private static bool BoxOverlap(Box a, Box b, double slack) => Clearance.BoxesWithin(a, b, slack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace OpenNest.Engine.Fill
|
||||
|
||||
reportProgress?.Invoke(adjusted, $"Extents: column {adjusted.Count} parts");
|
||||
|
||||
var result = RepeatColumns(adjusted, token);
|
||||
var result = RepeatColumns(adjusted);
|
||||
|
||||
reportProgress?.Invoke(result, $"Extents: {result.Count} parts total");
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace OpenNest.Engine.Fill
|
||||
|
||||
// --- Step 4: Horizontal Repetition ---
|
||||
|
||||
private List<Part> RepeatColumns(List<Part> column, CancellationToken token)
|
||||
private List<Part> RepeatColumns(List<Part> column)
|
||||
{
|
||||
if (column.Count == 0)
|
||||
return column;
|
||||
|
||||
@@ -51,10 +51,6 @@ namespace OpenNest.Engine.Fill
|
||||
/// </summary>
|
||||
private const int CandidateBatchSize = 8;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the plate
|
||||
/// </summary>
|
||||
private readonly Plate plate;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the plateSize
|
||||
@@ -94,7 +90,6 @@ namespace OpenNest.Engine.Fill
|
||||
/// <param name="dedup">The dedup<see cref="GridDedup"/></param>
|
||||
public PairFiller(Plate plate, IFillComparer comparer = null, GridDedup dedup = null)
|
||||
{
|
||||
this.plate = plate;
|
||||
this.plateSize = plate.Size;
|
||||
this.partSpacing = plate.PartSpacing;
|
||||
this.comparer = comparer ?? new DefaultFillComparer();
|
||||
|
||||
@@ -74,9 +74,9 @@ namespace OpenNest.Engine.Sequencing
|
||||
{
|
||||
for (var j = i + 1; j < n; j++)
|
||||
{
|
||||
var before = RouteDistance(ordered, exit, i, j);
|
||||
var before = RouteDistance(ordered, exit);
|
||||
Reverse(ordered, i, j);
|
||||
var after = RouteDistance(ordered, exit, i, j);
|
||||
var after = RouteDistance(ordered, exit);
|
||||
|
||||
if (after < before - Tolerance.Epsilon)
|
||||
{
|
||||
@@ -97,14 +97,10 @@ namespace OpenNest.Engine.Sequencing
|
||||
|
||||
/// <summary>
|
||||
/// Computes the total distance of the route starting from exit through all parts.
|
||||
/// Only the segment around the reversed segment [i..j] needs to be checked,
|
||||
/// but here we compute the full route cost for correctness.
|
||||
/// </summary>
|
||||
private static double RouteDistance(
|
||||
List<Part> ordered,
|
||||
OpenNest.Geometry.Vector exit,
|
||||
int i,
|
||||
int j
|
||||
OpenNest.Geometry.Vector exit
|
||||
)
|
||||
{
|
||||
// Full route distance: exit -> ordered[0] -> ... -> ordered[n-1]
|
||||
|
||||
Reference in new issue
Block a user