feat: update FindBestRotation to use rotating calipers algorithm

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 22:49:09 -05:00
parent a190ed25b4
commit 1c8763a201
3 changed files with 56 additions and 36 deletions

View File

@@ -598,16 +598,15 @@ namespace OpenNest.Geometry
}
}
public double FindBestRotation(double stepAngle)
public BoundingRectangleResult FindBestRotation()
{
var entities = new List<Entity>(ToLines());
return entities.FindBestRotation(stepAngle);
return RotatingCalipers.MinimumBoundingRectangle(Vertices);
}
public double FindBestRotation(double stepAngle, double startAngle, double endAngle)
public BoundingRectangleResult FindBestRotation(double startAngle, double endAngle)
{
var entities = new List<Entity>(ToLines());
return entities.FindBestRotation(stepAngle, startAngle, endAngle);
var hull = ConvexHull.Compute(Vertices);
return RotatingCalipers.MinimumBoundingRectangle(hull, startAngle, endAngle);
}
}
}