Found neighbour triangles

Hi

For my custom implementation i need to found neighbour triangles by edge for current triangle. For example triangle with vertex indices 0,1,2 is neighbour for triangle with inidcies 0,2,3 and second neighbour is 0,1,4

But UE is add duplicates vertices when importing mesh and compare just by vertex indices is not possible. What the best and fast way to find triangle neighbours?

It sounds like you need to build a spatial index of vertices. It looks like UE4 has an Octree class. Octree is a spatial index very similar to a binary search tree in 3d space. It looks like there is also a KDTree plugin. A KDTree is another spatial index.

You can put your vertices or polygon centroids inside of one of these spatial indexes, and then do a lookup for the nearest neighbors, probably in log(n) time.

Thanks! Seems that k-d tree is good approach for me.