feat: add SplitLineIntersect helper for entity-splitline intersection

Add ToLine() to SplitLine and create SplitLineIntersect static class with
FindIntersection, CrossesSplitLine, and SideOf methods for testing entity
intersections against split lines. These helpers support the upcoming
Clipper2-free DrawingSplitter rewrite.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 18:04:21 -04:00
parent cd8adc97d6
commit df18b72881
3 changed files with 300 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
using OpenNest.Geometry;
using System.Collections.Generic;
namespace OpenNest;
@@ -23,4 +24,16 @@ public class SplitLine
Position = position;
Axis = axis;
}
/// <summary>
/// Returns a Line entity at the split position spanning the given extent range.
/// For Vertical: line from (Position, extentStart) to (Position, extentEnd).
/// For Horizontal: line from (extentStart, Position) to (extentEnd, Position).
/// </summary>
public Line ToLine(double extentStart, double extentEnd)
{
return Axis == CutOffAxis.Vertical
? new Line(Position, extentStart, Position, extentEnd)
: new Line(extentStart, Position, extentEnd, Position);
}
}