refactor(core): share duplicated geometry helpers

Route the four identical even-odd ray casts through RingContainment.Contains and share the arc-intersection, span-pairing, overlap-region, lead-in, plate-offset, leader-edge, entity-copy and path-perimeter duplicates. Expressions and loop order are unchanged, so results are bit-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-11-28 18:36:40 -05:00
1 parent 8a1d89cea5
commit 409d30d29e
15 files changed
+108 -154

No files matched your search

+9 -13
View File
@@ -24,24 +24,20 @@ namespace OpenNest.Geometry
internal static bool Intersects(Arc arc, Circle circle, out List<Vector> pts)
{
var c1 = new Circle(arc.Center, arc.Radius);
if (!Intersects(c1, circle, out pts))
{
pts = new List<Vector>();
return false;
}
pts = PointsOnArc(arc, pts);
return pts.Count > 0;
var hit = Intersects(new Circle(arc.Center, arc.Radius), circle, out pts);
return KeepOnArc(arc, hit, ref pts);
}
internal static bool Intersects(Arc arc, Line line, out List<Vector> pts)
{
var c1 = new Circle(arc.Center, arc.Radius);
var hit = Intersects(new Circle(arc.Center, arc.Radius), line, out pts);
return KeepOnArc(arc, hit, ref pts);
}
if (!Intersects(c1, line, out pts))
/// <summary>Keeps the points of the arc's circle intersection that lie on the arc.</summary>
private static bool KeepOnArc(Arc arc, bool circleHit, ref List<Vector> pts)
{
if (!circleHit)
{
pts = new List<Vector>();
return false;