fix: small parts use FindScrapZones not FindAllRemnants

Small parts must only go into scrap zones (both dims < minRemnantSize)
to preserve viable remnants. The implementer had inverted this, giving
small parts access to all remnants. Also fixed the test to verify
remnant preservation behavior and removed unused FindAllRemnants helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 14:11:10 -04:00
parent fd3c2462df
commit f1fd211ba5
2 changed files with 14 additions and 13 deletions

View File

@@ -262,9 +262,9 @@ namespace OpenNest
if (classification == PartClass.Large)
continue; // Large parts don't go on existing plates — they create new ones.
// Get all remnants and try to place in them.
// Small parts only go into scrap zones; medium parts into viable remnants.
var remnants = classification == PartClass.Small
? FindAllRemnants(pr.Plate)
? FindScrapZones(pr.Plate, minRemnantSize)
: FindViableRemnants(pr.Plate, minRemnantSize);
foreach (var zone in remnants)
@@ -435,12 +435,6 @@ namespace OpenNest
return false;
}
private static List<Box> FindAllRemnants(Plate plate)
{
var finder = RemnantFinder.FromPlate(plate);
return finder.FindRemnants();
}
private static NestItem CloneItem(NestItem item)
{
return new NestItem