Grasshopper

algorithmic modeling for Rhino

I'm having a hard time identifying duplicate points. Attached is a definition that seems like it would work. So far using it sometimes works better than, and sometimes worse or the same than the definition offered here: http://www.grasshopper3d.com/forum/topics/how-to-remove-duplicate-p... .

But neither work as well as the removeDuplicatPts component available in the Kangaroo plug-in. In the attached, it fails to identify two duplicate points. As vertices of a dodecahedron, there should only remain 12 points. I want to develop my own definition with the same consistency as the Kangaroo version for a few reasons:

  • I don't want to be so dependent on the Kangaroo component -- I had a few difficult days without it when it didn't work with the latest GH update.
  • Since without it, I've gotten curious and simply want to understand how to program this.
  • And most importantly, I need index identification of duplicate points more than the raw elimination of them. The Kangaroo component doesn't offer this and I plan to use point location identifiers to help remove duplicates of more complicated objects.

It seems like the problem is due to incorrectly sorting zero values that show up as extremely small exponentials e-15 or e-16; But I'm not sure. Adding a small but cumulatively larger value to each list item being sorted seems to help to a degree; but not enough.

Any thoughts about improving this definition or suggestions about a completely different approach would be great.

 

Views: 6516

Attachments:

Reply to This

Replies to This Discussion

There is an SDK function that does exactly the same as the kangaroo component. Try the following code:

 

private void RunScript(List<Point3d> P, double t, ref object A)  {

    if(double.IsNaN(t) || t == 0){

      t = RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;    

}    

A = Point3d.CullDuplicates(P, t);

}

But can it be adapted to provide grasshopper all the index numbers for a list of duplicate points?

David Reeves made a definition to do this and posted it on the old kangaroo group some time ago:

https://groups.google.com/group/kangaroophysics/browse_thread/threa...

the file is in the downloads section:

https://groups.google.com/group/kangaroophysics/files

(duplicate_rebuild.ghx)

I got really excited for a second. I didn't think to search the Kangaroo forum. Unfortunately, the duplicate_rebuild script performs worse than the the pure grasshopper definitions presented in the opening post.

I've been working on some geodesic dome stuff. Attached is a definition culled down to just provide sufficient points to compare different "find duplicate" methods. You can see how everything performs so far. None come close to the Kangaroo version. What's the winning technique used in the Kangaroo version?

Attachments:

After having this on my mind, it really seems like there's a bug or some problem with how the 'Sort List' component handles sorting multiple values of zero. It appears that it doesn't keep corresponding data in their proper order.

I just switched to using the Z-value of the points for sorting, and my definition works exactly as designed.

Attached shows how 'Sort List' fails on zeros (or very small numbers).

Attachments:

Here's an updated version of the remove duplicates component Daniel mentioned. It spits out an index tree as well for rebuilding sake. I double checked just to make sure and it appears to be working. If it's still giving you trouble try bumping up the absolute tolerance in your rhino document settings.

Attachments:
This one seems robust. It works like a charm. Thanks!

David, the component works great. I like it a lot too.

 

Could you update it with another output similar to "A", but which prints, i.e, value "1" for the geometries that had duplicates, value "0" for those of the list that were uniques?  

still great in 2012 ;) 

thanks david!

just in case somebody comes here:

since Grasshopper 0.9.0005, there is an official component for this.

see "new features" section at http://www.grasshopper3d.com/forum/topics/grasshopper-0-9-0005-avai...

there it says "Added Cull Duplicate Points component (Vector.Point dropdown)."

Best regards
  Stefan

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2019   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service