Mesh Mesh Intersection


I would like to ask if there is an existing RhinoCommon method that could help me identify mesh faces that touch each other. MeshMeshFast or MeshMeshAccurate outputs geometry only (lines or polylines). This I use just for identifying if meshes are colliding. But I am trying to find out touching mesh faces id.

First I was thinking that I could somehow search coplanar planes. But since meshes could have many faces, the search could be slow.
Is the only way:

  1. iterate over each mesh face
  2. get its center
  3. search mesh closest-point
  4. skip result if distance between two points is bigger than a tolance?

File.3dm (95.4 KB)

Hi @Petras_Vestartas,

you might try to use mesh.Faces.GetClashingFacePairs(). It works for a single mesh though. Maybe if you create a temp mesh and append your 2 meshes, you could assign the indices returned in pairs by comparison to the face count of the first mesh sphere.

Only rough testing done: (1.6 KB)



This this method only works, when mesh faces are exactly the same, and touching at the same vertices.
If faces are touching but are shifted it will return null:

Hey @Petras_Vestartas

You can use MeshClash.Search but you won’t avoid iterating through the faces of each mesh

Here’s a very crass example (26.9 KB)

This is already much improved in the WIP, if you want to give it a shot:

Hope this helps.


Thanks David for the answer. I will try to reduce the search by bbox check first and the use clash detection.

Elaborate more on this and off you go. (148.5 KB)

To do:

  1. Check meshes (disjoined, manifold, maybe triangulate etc etc).
  2. Cluster the mList based on ccx events (that’s critical).
  3. Provide a box - box first check as an option (i.e. do Interval comparisons AND not box/box ccx).
  4. Attempt a thread safe // approach.
  5. Better visualize (use TextDots and the likes) the display situation.

May the Force (the dark option) be with you.


Thank you @PeterFotiadis