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.
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest.CNC.CuttingStrategy
|
|
{
|
|
public class ArcLeadIn : LeadIn
|
|
{
|
|
public double Radius { get; set; }
|
|
|
|
public override List<ICode> Generate(
|
|
Vector contourStartPoint,
|
|
double contourNormalAngle,
|
|
RotationType winding = RotationType.CW
|
|
)
|
|
{
|
|
var piercePoint = GetPiercePoint(contourStartPoint, contourNormalAngle);
|
|
|
|
var arcCenter = new Vector(
|
|
contourStartPoint.X + Radius * System.Math.Cos(contourNormalAngle),
|
|
contourStartPoint.Y + Radius * System.Math.Sin(contourNormalAngle)
|
|
);
|
|
|
|
return new List<ICode>
|
|
{
|
|
new RapidMove(piercePoint),
|
|
new ArcMove(contourStartPoint, arcCenter, winding) { Layer = LayerType.Leadin },
|
|
};
|
|
}
|
|
|
|
public override Vector GetPiercePoint(Vector contourStartPoint, double contourNormalAngle)
|
|
{
|
|
var arcCenterX = contourStartPoint.X + Radius * System.Math.Cos(contourNormalAngle);
|
|
var arcCenterY = contourStartPoint.Y + Radius * System.Math.Sin(contourNormalAngle);
|
|
|
|
return new Vector(
|
|
arcCenterX + Radius * System.Math.Cos(contourNormalAngle),
|
|
arcCenterY + Radius * System.Math.Sin(contourNormalAngle)
|
|
);
|
|
}
|
|
|
|
public override LeadIn Scale(double factor) => new ArcLeadIn { Radius = Radius * factor };
|
|
}
|
|
}
|