Detect overlapping faces (OpenMaya)

Hmm, If I were to do that …
Rather than checking face by face, I would start by finding all vertices that are on top of each other.
To speed this up, I’d probably sort the verts by their X values. Then just group any verts with the same x-value together, and check within those groups for duplicates.
Then just find the faces that use only duplicated vertices. Once you’ve got that you can pretty easily check which faces map to the same point-groups.
I’m fairly certain this isn’t the 100% best algorithm, but it’s probably a “good enough in practice” one.

All that data’s available on MFnMesh, or through an iterator, and it’s available many ways.

My own personal preference would probably be to use the raw face connectivity data available from MFnMesh.getVertices, and the vertex position data from MFnMesh.getPoints.

1 Like