From 17f786c9e8c73a88961805759d9b40e372e341eb Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sat, 28 Mar 2026 16:14:51 -0400 Subject: [PATCH] refactor: delegate Program.Rotate(angle) to Rotate(angle, origin) The parameterless rotation is equivalent to rotating around (0,0), so delegate to the origin overload to eliminate 30-line duplicate. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest.Core/CNC/Program.cs | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/OpenNest.Core/CNC/Program.cs b/OpenNest.Core/CNC/Program.cs index 43d6237..4781e20 100644 --- a/OpenNest.Core/CNC/Program.cs +++ b/OpenNest.Core/CNC/Program.cs @@ -51,37 +51,7 @@ namespace OpenNest.CNC mode = Mode.Absolute; } - public virtual void Rotate(double angle) - { - var mode = Mode; - - SetModeAbs(); - - for (int i = 0; i < Codes.Count; ++i) - { - var code = Codes[i]; - - if (code.Type == CodeType.SubProgramCall) - { - var subpgm = (SubProgramCall)code; - - if (subpgm.Program != null) - subpgm.Program.Rotate(angle); - } - - if (code is Motion == false) - continue; - - var code2 = (Motion)code; - - code2.Rotate(angle); - } - - if (mode == Mode.Incremental) - SetModeInc(); - - Rotation = Angle.NormalizeRad(Rotation + angle); - } + public virtual void Rotate(double angle) => Rotate(angle, new Vector(0, 0)); public override string ToString() {