Grasshopper

algorithmic modeling for Rhino

Eliminate those lines that are intersecting with each other

Hello,

As part of a bigger task, I am now stuck at the following stage: I am trying to eliminate all lines that are intersecting with each other. Any sugestions ?

Thank you.

Views: 336

Attachments:

Replies to This Discussion

The problem with Line|Line intersections is that they treat all lines as infinite objects. You need to use MultipleCurve intersections, which is pretty slow. Basically it intersects each curve with every subsequent curve, so for 5000 lines you end up performing ~ (5000 * 4999)/2 = 12497500 intersections. This takes a good 20 seconds on my machine.

Once you have a set of all the curve indices involved in intersections, you can cull based on those indices:

and the file...

Attachments:

And here's a custom c# script that takes only 4 seconds.

Attachments:

Hello David,

Thank you for your prompt reply. The script works great.

Regards,

Bogdan

There are other ways to speed this up, primarily by putting lines into spatial boxes so you can quickly reject the majority of them without performing any intersections. That'll take a lot of coding however.

I agree that there is always room for improvement. I actually thought about using, not boxes but circles, in an attempt to define some spatial borders. However, it didn’t get me too far since I’m still a novice in Grasshopper. I will most probably come back to issues like the one I have asked help for and try to fine tune it, once my project starts to take shape and I accumulate some experience. At the moment I need a basic structure that runs my task.

Thank you for your suggestion David.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service