Detect intersecting closed solid Breps (not touching)

Is there any way to detect closed solid Breps that intersect their volume? the “Shape in Brep” node do not differentiate between intersecting, or only touching. How to add this feature to my algorithm? In the end I would like to turn red all the objects that intersect volumes (touching excluded, entirely englobed included). I attach the algorithm I’ve prepared so far.

I thought I could perform a boolean operation for all those pairs of solids that are tested positive for intersection (output equal to 1) by the “Shape in Brep” node, calculate the volume and select only the pairs that have an intersection volume greater than zero, however, this would take a lot of time and I’m planning to use this algorithm on entire buildings made of hundreds of solids, so it would take maybe to much time. any more efficient idea?

intersecting volumes.gh (33.7 KB)

do you maybe know if this is doable at all in rhino without grasshopper?

I implemented the approach with the boolean operation that I mentioned in my previous comment and it works, but it is very slow for high amount of elements.

if you have any idea on how to improve the performances on this one it would be much appreciated!

intersecting volumes.gh (37.7 KB)

You could try with clash


RE intersecting volumes.gh (38.8 KB)
sure not perfect but maybe helpful.

OH! that’s quite what I was looking for! thanks!

The boolean is still necessary though, is there any way to skip the boolean at all?

This is a classic flat hard Clustering task (where a Cluster is a collection of items satisfying a given set of criteria - in this case a single one [ the ccx thing]).

A classic way to speed things (other than a thread safe // approach) is to use a precheck: get the BoundingBoxes and then test their Interval intersections (in x/y/z). If there’s none the items are isolated (meaning: go to the next pair). If there’s intersection then a final 2nd check is required (in this case the real Ccx test).

Obviously if all items are Boxes … that makes things way faster

I could provide a simple entry level demo … but using solely code (C#).

Thanks for the explanation, it makes total sense
the code would be definitely be helpful!

In fact I’m a zillion miles far and away from base (summer windsurfing period … blah. blah) but I’ll see - later on - what I can do using an ancient laptop (used solely for F1/MotoGP/WSB stuff - but this is a very simple case anyway).

BTW: Found some stuff (but is strictly internal: using RTrees). 1400 Boxes in 15 milliseconds (expect 5 ms max via a proper I9).

Cool! I think you forgot to share the GH though!

No. It’s just that the captured is a strictly internal thingy (meaning using Methods that would never see the lights of publicity).

So I wrote from scratch a simple take on that matter: skipped the Intervals precheck but using instead a Brep > Mesh approach (if obviously the GeometryBase object is Brep) that yields more or less fast results [Note: 3 options available]).

Clusters_CCX_On_MeshesOrBreps_PublicDemo_V1D.gh (631 KB)

These options are (shown a part of the classic Clustering Method):

Anyway even in this heavily derestricted build the Elapsed is not that bad (3-4 ms for 1000+ simple GeometryBase Type objects).

1 Like

Oh! I see, thanks a lot for the effort!
I’ll test it and let you know how it goes on my scene, thanks!
R