fix: normalize best-fit pairs to landscape and fix viewer size swap
Normalize pair bounding box to landscape (width >= height) in PairEvaluator for consistent display and filtering. Fix BestFitViewerForm where BoundingWidth/BoundingHeight were passed in the wrong order to the plate Size constructor. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using OpenNest.Converters;
|
using OpenNest.Converters;
|
||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
using OpenNest.Math;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -67,6 +68,15 @@ namespace OpenNest.Engine.BestFit
|
|||||||
|
|
||||||
var trueArea = drawing.Area * 2;
|
var trueArea = drawing.Area * 2;
|
||||||
|
|
||||||
|
// Normalize to landscape (width >= height) for consistent display.
|
||||||
|
if (bestHeight > bestWidth)
|
||||||
|
{
|
||||||
|
var tmp = bestWidth;
|
||||||
|
bestWidth = bestHeight;
|
||||||
|
bestHeight = tmp;
|
||||||
|
bestRotation += Angle.HalfPI;
|
||||||
|
}
|
||||||
|
|
||||||
return new BestFitResult
|
return new BestFitResult
|
||||||
{
|
{
|
||||||
Candidate = candidate,
|
Candidate = candidate,
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ namespace OpenNest.Forms
|
|||||||
cell.PartColor = partColor;
|
cell.PartColor = partColor;
|
||||||
cell.Dock = DockStyle.Fill;
|
cell.Dock = DockStyle.Fill;
|
||||||
cell.Plate.Size = new Geometry.Size(
|
cell.Plate.Size = new Geometry.Size(
|
||||||
result.BoundingHeight,
|
result.BoundingWidth,
|
||||||
result.BoundingWidth);
|
result.BoundingHeight);
|
||||||
|
|
||||||
var parts = result.BuildParts(drawing);
|
var parts = result.BuildParts(drawing);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user