fix(core): emit line instead of arc for near-zero sweep to avoid full-circle misinterpretation
Near-zero-sweep arcs with large radius (e.g. from ellipse converter) have nearly-coincident start/end points. Downstream code (ConvertProgram, Program BoundingBox) treats coincident start/end as a full 360° circle, inflating the bounding box and rendering wrong geometry. Emit a LinearMove when sweep is negligible — geometrically equivalent and avoids the ambiguity. Also fix the ellipse converter to produce lines instead of degenerate arcs at the source. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -173,7 +173,11 @@ namespace OpenNest.Geometry
|
||||
|
||||
if (maxDev <= tolerance)
|
||||
{
|
||||
results.Add(CreateArc(arcCenter, radius, center, semiMajor, semiMinor, rotation, t0, t1));
|
||||
var arc = CreateArc(arcCenter, radius, center, semiMajor, semiMinor, rotation, t0, t1);
|
||||
if (arc.SweepAngle() < Tolerance.Epsilon)
|
||||
results.Add(new Line(p0, p1));
|
||||
else
|
||||
results.Add(arc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user