How to find the simplex containing a specific point using pointLocation in Matlab?

1 view (last 30 days)
During the use of the Matlab function pointLocation I encountered a problem. If a certain query point is located directly on the face between two tetrahedra the function returns NaN as a value as it cannot specify which simplex contains the point. As a minimal example where the function fails to provide the tetrahedron we can use:
TopoTet = [1,2,3,4;5,4,2,1];
CoorTet = [5.454545500000000,2.121212010000000,5.454545500000000;...
5.151515010000000,2.121212010000000,5.151515010000000;...
5.454545500000000,2.121212010000000,5.151515010000000;...
5.151515010000000,1.818181870000000,5.151515010000000;...
5.151515010000000,2.121212010000000,5.454545500000000];
TR = triangulation(TopoTet,CoorTet);
QP = [5.29546022000000,2.02924132000000,5.29546022000000];
[ElemIdTet,LocalCoorTet] = pointLocation(TR,QP);
However, for my code it is of utmost importance to obtain the index to at least one of the tetrahedra (it would be best if both tetrahedra would be returned as answer). This search is performed for many thousands of query points and tetrahedra. Do you have any idea how to devise a fast/efficient algorithm to circumvent the mentioned problem?
Thanks a lot!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!