How to find which a mesh is fast?

A point(Red) is on the mesh or near the mesh.
How to know which a triangle(yellow) is fast ?
Before, I found a triangle through a distance which was calculated by a point with all mesh’s points.
But, It is very slow. Whether a better method exists ?

Why not use ON_MeshGetClosestPoint?

bool rc = ON_MeshGetClosestPoint( mesh, pt, &t, tol );

Because I don’t know this function. :weary:
I get a point on mesh through the function and get a yellow triangle by the point ( ON_MESH_POINT t )?
But, this result maybe exist triangles more than one.

Thanks Dale.

Hi kaicihuang,

The ON_MESH_POINT class contains all the information you need. It contains a member m_ci of type ON_COMPONENT_INDEX which says whether the closest point is on a vertex, edge or face. If the closest point is a vertex, like in your image, you can find the topological vertex index value and use the ON_MeshTopology class to find all adjacent triangles.


t.m_ci.m_type // The type of mesh component which is closest
t.m_ci.m_index // The topological index of the component which is closest

Hope this helps.


Thanks you. :smile:
It is clear.