search for triangle containing a point?

Jun 12, 2013 at 3:40 PM
Edited Jun 12, 2013 at 3:43 PM
I would like to search a mesh for a triangle that contains a given point (or has an edge/vertex on the point).

Do I need to write my own routine to traverse the mesh or is there an existing method?

Does TriangleNet.Mesh.Locate do this? I see it is internal and not public.

Thanks...
Coordinator
Jun 12, 2013 at 3:56 PM
The Locate routine is designed for convex triangulations only. So if your mesh has holes or concave boundary parts, the code might fail.

Generally, if you have a lot of queries to the same mesh, I would recommend you build a spatial index for that mesh. I have used the Quadtree Simulator project before, which worked very well. Queries are then O(log n).
Jun 12, 2013 at 10:33 PM
Thank you.

I have it working using the C# implementation of a quadtree I found here: http://www.codeproject.com/Articles/30535/A-Simple-QuadTree-Implementation-in-C

Thanks for the advice and Thanks for the excellent Triangle.NET.