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.
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest;
|
|
|
|
public class StraightSplit : ISplitFeature
|
|
{
|
|
public string Name => "Straight";
|
|
|
|
public SplitFeatureResult GenerateFeatures(
|
|
SplitLine line,
|
|
double extentStart,
|
|
double extentEnd,
|
|
SplitParameters parameters
|
|
)
|
|
{
|
|
var (negEdge, posEdge) =
|
|
line.Axis == CutOffAxis.Vertical
|
|
? (
|
|
new Line(
|
|
new Vector(line.Position, extentStart),
|
|
new Vector(line.Position, extentEnd)
|
|
),
|
|
new Line(
|
|
new Vector(line.Position, extentEnd),
|
|
new Vector(line.Position, extentStart)
|
|
)
|
|
)
|
|
: (
|
|
new Line(
|
|
new Vector(extentStart, line.Position),
|
|
new Vector(extentEnd, line.Position)
|
|
),
|
|
new Line(
|
|
new Vector(extentEnd, line.Position),
|
|
new Vector(extentStart, line.Position)
|
|
)
|
|
);
|
|
|
|
return new SplitFeatureResult(new List<Entity> { negEdge }, new List<Entity> { posEdge });
|
|
}
|
|
}
|