fix: use chain tolerance for shape building to handle DXF endpoint gaps
DXF files can have endpoint gaps at entity junctions that fall right at the floating-point boundary of Tolerance.Epsilon (0.00001). This caused shapes to not close, resulting in 0 area and 0% utilization in Best-Fit. Added ChainTolerance (0.0001) for endpoint chaining in GetConnected and Shape.IsClosed, keeping the tighter Epsilon for geometric precision. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,12 @@ namespace OpenNest.Math
|
||||
{
|
||||
public const double Epsilon = 0.00001;
|
||||
|
||||
/// <summary>
|
||||
/// Tolerance for chaining entity endpoints when building shapes from DXF imports.
|
||||
/// Larger than Epsilon to handle floating-point gaps at entity junctions.
|
||||
/// </summary>
|
||||
public const double ChainTolerance = 0.0001;
|
||||
|
||||
public static bool IsEqualTo(this double a, double b, double tolerance = Epsilon)
|
||||
{
|
||||
return System.Math.Abs(b - a) <= tolerance;
|
||||
|
||||
Reference in New Issue
Block a user