Point-to-Mesh Projection and AABB Acceleration
The functionality for projecting points to the nearest point on a mesh is typically accelerated using AABB trees. The typical workflow involves first constructing an MR::AABBTree
for the entire mesh. During projection or distance calculations, the querying interface of the AABB tree (such as functions to find the nearest triangle) is invoked to rapidly filter candidate triangles. Subsequently, the precise distance from the point to each of these candidate faces is computed individually to identify the true nearest point. This hierarchical spatial indexing significantly reduces the overhead of traversing all triangles.
For nearest neighbor searches between points (e.g., point cloud matching), the same principle applies using MR::AABBTreePoints
for the set of vertices in the mesh: an AABB tree for the vertices is built, allowing for proximity queries within that structure. The entire function chain for point-to-face operations typically traverses modules such as MRMeshIntersect
and MRMeshDistance
, invoking calls sequentially from high-level interfaces down to the underlying AABB queries.