Reputation: 133
Given a triangular mesh A in 3D space. Rotate and translate all its points to generate a new mesh B.
How to determine the equality of A and B, just by their vertices and faces?
Topology of the mesh is not important, I only care about the geometric equality, A and B should be equal even if their triangulation are changed. It is something like the transform in-variance problem for triangular mesh, only translate and rotation is considered.
Upvotes: 1
Views: 992
Reputation: 11
The paper On 3D Shape Similarity (Heung-yeung Shum, Martial Hebert, Katsushi Ikeuchi) computes a similarity score between two triangular meshes by comparing semiregular sphere tessellations that have been deformed to approximate the original meshes.
In this case, the meshes are expected to be identical (up to some small error due to the transformation), so an algorithm inspired by the paper could be constructed as follows:
A
, B
by the number of neighboring vertices they have.V_A
from mesh A
and vertex V_Bi
from mesh B
, both with same number of neighbors.N
neighbors V_n1
...V_nN
form a triangle fan of N
triangles. Construct N
transforms which take vertex V_Bi
to V_A
and each possible fan (starting from a different neighbor V_Bn1
, V_Bn2
, ..., V_BnN
) to V_An1
...V_AnN
.B
to the closest vertex to it in A
, for each N
transforms for each vertex V_Bi
.If a sum of near zero is found, the vertices of the transformed mesh B
coincide with vertices of A
, a mapping between them can be constructed, and you can do further topological, edge presence or direction checks, as needed.
Upvotes: 1
Reputation: 51863
Assuming triangle faces only.
compare number of triangles
if not matching return false
.
sort triangles by their size
if the sizes and order does not match between both meshes return false.
find distinct triangle in shapes
So either the biggest or smallest in area, edge length or whatever. If not present then you need other distinct feature like 2 most distant points etc ... If none present even that then you need the RANSAC for this.
Align both meshes so the matching triangles (or feature points) will have the same position in both meshes.
compare matching vertexes
so find the closest vertex form Mesh A to each vertex in mesh B and if the distance of any them cross some threshold return false
return true
In case meshes has no distinct features for 3 you need to either use brute force loop through all combinations of triangles form A and B until #4 returns true or all combinations tested or use RANSAC for this.
There are alternatives to #3 like find the centroid and closest and farthermost points to it and use them as basis vectors instead of triangle. that requires single vertex or close group of vertexes to be the min and max. if not present like in symmetrical meshes like cube icosahedron, sphere you're out of luck.
You can enhance this by using other features from the mesh if present like color, texture coordinate ...
[Edit1] just a crazy thinking on partial approach without the need of aligninig
compute average point C
compute biggest inscribed sphere centered at C
just distance from C
to its closest point
compute smallest outscribed sphere centered at C
just distance from C
to its farthest point
compare the radiuses between the shapes
if not equal shapes are not identical for sure. If equal then you have to check with approaches above.
Upvotes: 2
Reputation: 1310
To complete @Spektre's answer, if the two meshes are not exactly the same, that is there is at least a pair of nodes or edges which does not perfectly overlap, You can use the Hausdorff distance to quantify the "difference" between the two meshes.
Upvotes: 1