feat(engine): include rotating calipers angle in pair nesting tiling
PairEvaluator already computes OptimalRotation via RotatingCalipers on the pair's convex hull, but PairFiller.EvaluateCandidate only passed hull edge angles to FillPattern. Now includes the optimal rotation angle (and +90°) so tiling can use the mathematically tightest fit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -107,7 +107,17 @@ namespace OpenNest.Engine.Fill
|
||||
var p90 = FillHelpers.BuildRotatedPattern(pairParts, Angle.HalfPI);
|
||||
engine.RemainderPatterns = new List<Pattern> { p0, p90 };
|
||||
|
||||
return FillHelpers.FillPattern(engine, pairParts, candidate.HullAngles, workArea);
|
||||
// Include the pair's rotating calipers optimal rotation angle
|
||||
// alongside the hull edge angles for tiling.
|
||||
var angles = new List<double>(candidate.HullAngles);
|
||||
var optAngle = -candidate.OptimalRotation;
|
||||
if (!angles.Any(a => a.IsEqualTo(optAngle)))
|
||||
angles.Add(optAngle);
|
||||
var optAngle90 = Angle.NormalizeRad(optAngle + Angle.HalfPI);
|
||||
if (!angles.Any(a => a.IsEqualTo(optAngle90)))
|
||||
angles.Add(optAngle90);
|
||||
|
||||
return FillHelpers.FillPattern(engine, pairParts, angles, workArea);
|
||||
}
|
||||
|
||||
private List<BestFitResult> SelectPairCandidates(List<BestFitResult> bestFits, Box workArea)
|
||||
|
||||
Reference in New Issue
Block a user