Query triangle in which a point lies in CGAL 2D

Viewed 95

I am working with 2D meshes with all triangles, represented using CGAL as CGAL::Surface_mesh<K::Point_2>. Given a set of 2D points, I want to find in which triangle each points is.

I have tried CGAL::AABB_tree, but apparently the CGAL::AABB_traits is made for 3D queries. I guess I could use 3D meshes with z = 0, but in that case I fear the AABB may be incorrect, since the bounding boxes will have 0 length in the z direction.

Which would be the best way to perform this 2D lookup?

1 Answers

You can use the Location Functions. Did you consider using a 2D triangulation and a projection traits as an alternative? See this example.

Related