How to check if a brep is self-intersecting?

Is there an easy way to check if a cylinder-like brep (composed of multiple surfaces) intersects itself anywhere other than the edges of the component surfaces? I don’t need a list of intersections, just a binary “does this thing go through itself” indicator that I can use to test for fitness.

My current strategy looks like deconstruct brep -> test each surface for intersections with each other surface -> for each intersection, reject if it equals one edge of each surface. But that looks like it’s going to be painful and slow.

Any better ways? Sample breps attached (with apologies for size, but they are brep entities with internalised data)

self-interect.gh (1.0 MB)

Hi @brooks,

RhinoCommon for Rhino 7 contains a new Mesh.GetSelfIntersections method which help with this.

Just convert your Breps to meshes and then pass the mesh to the above method. I’ve attached a sample for you to review.

self-interect.gh (1.0 MB)

– Dale

1 Like

Thank you!

RH-62336 is fixed in the latest Rhino 7 Service Release Candidate

1 Like