Files
OpenNest/OpenNest.Engine/Strategies/ExtentsFillStrategy.cs
T
aj aec0523062 style: apply CSharpier formatting to all C# sources
Repo-wide sweep with the pinned CSharpier 1.3.0 tool. Whitespace and
line-wrapping only; OpenNest.Engine.Tests (109) and OpenNest.IO.Tests
pass after reformat, full solution builds 0 errors.

Added .csharpierignore so csproj/config XML keeps its existing layout
(CSharpier's XML wrapping churns attributes with zero benefit).

Formatting is now enforceable: dotnet csharpier check . passes.
2026-09-20 16:41:50 -04:00

35 lines
1.1 KiB
C#

using System.Collections.Generic;
using OpenNest.Engine.Fill;
using OpenNest.Math;
namespace OpenNest.Engine.Strategies
{
public class ExtentsFillStrategy : IFillStrategy
{
public string Name => "Extents";
public NestPhase Phase => NestPhase.Extents;
public int Order => 300;
public List<Part> Fill(FillContext context)
{
if (context.PartType == PartType.Rectangle || context.PartType == PartType.Circle)
return null;
var filler = new FillExtents(context.WorkArea, context.Plate.PartSpacing);
var bestRotation = context.SharedState.TryGetValue("BestRotation", out var rot)
? (double)rot
: RotationAnalysis.FindBestRotation(context.Item);
var angles = new[] { bestRotation, bestRotation + Angle.HalfPI };
return FillHelpers.BestOverAngles(
context,
angles,
angle =>
filler.Fill(context.Item.Drawing, angle, context.Token, context.ReportProgress),
"Extents"
);
}
}
}