# Is it possible to compare 2 meshes for the complementarity of their respective surfaces?

Is there a way in Blender to compare two pieces of mesh or two meshes to its similarity? Maybe with some script or an addon.

What I mean: there is a stone or brick broken into half for example:

This is a kind of forensic or architectural task. The goal is to prove that those 2 pieces have similar surfaces and may be connected to each other with some threshold or they were a one piece before. I know of "select similar" in Blender, similar face area in this case, but it doesn't work quite well for such a task.

I am not a coder so I can't figure out a possibility of solving this.
So what is the way to do it?

• The bmesh python module has calc_volume which could be a quick test to see if you need further testing. I would look at the normal baking code, it measures distance between two meshes, maybe you could bake a normal map - the bigger the colour difference the bigger the variation in surface. – sambler May 5 '15 at 15:05
• The problem is you aren't really measuring the similarity of two meshes but rather how well they fit together. If they were similar you could just use something like iterative closest point to align them and then compare them . For your current problem, you have to compare one mesh in every orientation over the entire surface of the other mesh. You could try manually setting a best guess position and then get some minimisation function to tweak the transform until the points of the mesh are as close as they can be without any severe intersections. – DevTim May 5 '15 at 17:34
• @sambler Great idea! Why not writing this as answer? I would like to upvote it :) – p2or May 8 '15 at 9:38
• I've been noticing that this is a problem everywhere-- robotics and industry cad stuff to mention a couple. I'm thinking about using the automated bio molecule docking software like ftdock or gramm or something. Those people REALLY do NOT mess around. The only issue there is you have to turn your meshes into proteins for a bit. – Todd Pierce Apr 25 '16 at 3:03
• This is generally an NP-hard computer science problem (graph isomorphy), meaning that even for small meshes, the work to be done in order to solve this problem quickly becomes prohibitive. However, it would be possible to solve this fairly efficiently if the user helped by selecting a few vertices that are known to match in both meshes. – Pascal Jan 3 '18 at 1:33