Looking at the number of questions regarding this, perhaps it might be worthwhile having a component that does this? Perhaps it could even have a user controlled tolerance for the kinda-sorta look alike... a bit... somewhat cases?
Yes, that's what I figured. As soon as you allow tolerances it becomes a whole lot harder to solve these cases (except for points). Exact duplicates shouldn't be too hard.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Permalink Reply by Rafi on January 15, 2010 at 12:20pm
Hallo David,
I just want delete congruent curves and points which are exact duplicates!
if you're looking at exact duplicates of curves and points, here's what I'd do:
1) Write a new class in a VB or C# component that implements IComparer(Of IOnCurve). You can check easy properties first (boundingbox, length, start and end points), if these all turn out to be the same, you'll eventually have to drill down all the way to Nurbs properties (i.e. compare the CV array and Knot-Vectors of the curves), but perhaps it's good enough to stick with the easy comparisons.
2) Iterate through a list of IOnCurves (or OnCurves, or OnNurbsCurves, whatever you've got), and slowly populate a SortedList or SortedDictionary as you loop. This SortedList must be aware of your Comparer. Then, whenever you encounter a curve which already has been handled before, you know you've got a duplicate.
This is not exactly trivial, not even for the somewhat experienced DotNetters. I'll see if I have some time tomorrow to implement this.
I just wrote this VB script component, not sure what the density capability is, but it removes duplicates for points, lines and curves. Let me know how it works for your large number of points.
I have exactly the same problem - In my case its identical points - or points that share the same z coordinate, but it would be great to have a component for all kinds of objects.