I am working on the removal of duplicate model geometry using the Rhino3dm functionality in .NET. During this, a few things have come up:
As a suggestion for Rhino3dm in .NET, it would be a nice convenience if Rhino.Geometry.NurbsSurface.EpsilonEquals() also compared control points. I suspect this may have accidentally been left out given that Rhino.Geometry.NurbsCurve.EpsilonEquals() does compare control points.
Out of curiosity, why don’t the EpsilonEquals() functions check the vector distance between points, rather than the difference in vector components, as is currently done? I see that Rhino.Geometry.Point3d.CullDuplicates() checks whether the vector distance between two points is within tolerance, whilst all EpsilonEquals() functions check whether the differences in vector components of points are within tolerance. My interpretation is that Rhino’s model absolute tolerance is in relation to vector distance. Therefore, to me, it would make more sense for the EpsilonEquals() functions to do this also.
Is the following the best approach for detecting duplicates? To detect duplicate points, I call Rhino.Geometry.Point3d.CullDuplicates. To detect duplicate curves, I convert all curves to NurbsCurve (splitting polycurves into each segment first), then call Rhino.Geometry.NurbsCurve.EpsilonEquals() for forward and reverse. To detect duplicate surfaces, I convert all surfaces to NurbsSurface, then call Rhino.Geometry.NurbsSurface.EpsilonEquals() and NurbsSurfacePointList.EpsilonEquals() for each possible reverse. I am using Rhino.FileIO.File3dmSettings.ModelAbsoluteTolerance as my tolerance.