Grasshopper

algorithmic modeling for Rhino

I have a list of intervals to extract sub-curves, but some of these intervals have overlapping-ranges.
How can I merge these intervals into non-overlapping intervals?


For example

input
-------
0.0 to 0.7
0.1 to 0.3
0.2 to 0.6
0.8 to 1.0

output
---------
0.0 to 0.7
0.8 to 1.0


Views: 272

Replies to This Discussion

Try the attached script component. It has two functions (DoesIntervalOverlap and MergeIntervals) that it implements on the list of intervals. It would be pretty easy to mimic theses functions directly in GH, but I'm not sure about recreating how it works on the list. Regardless, the scripting component should take care of it for you.

Note: this was done with 0.7.30... let me know if you're still working on 6.xx
Attachments:
Wow!
Your script component works very well.
Exactly what i wanted to do.

Thanks

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service