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

+2 -11
View File
@@ -1193,17 +1193,8 @@ namespace OpenNest.Engine.Fill
return enter < leave;
}
private static List<Entity> CloneEntitiesAt(List<Entity> entities, Vector position)
{
var result = new List<Entity>(entities.Count);
foreach (var entity in entities)
{
var copy = entity.Clone();
copy.Offset(position);
result.Add(copy);
}
return result;
}
private static List<Entity> CloneEntitiesAt(List<Entity> entities, Vector position) =>
PartGeometry.CopyEntitiesAtLocation(entities, position);
private static bool TryConvexDirectExit(
RingSet moving, RingSet stationary, Vector movePos, Vector fixedPos,
@@ -161,17 +161,7 @@ internal sealed class BlockCatalog : IDisposable
return width;
}
private static double Perimeter(PathD outline)
{
var perimeter = 0.0;
for (var i = 0; i < outline.Count; i++)
{
var a = outline[i];
var b = outline[(i + 1) % outline.Count];
perimeter += System.Math.Sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y));
}
return perimeter;
}
private static double Perimeter(PathD outline) => SheetOutline.Perimeter(outline);
}
/// <summary>