Find tetrahedron in which a point lays and get its barycentric coordinates
I have some tetrahedrons and a point cloud. For each point in the point cloud, I want to know in which tetrahedron it lays and what are its barycentric coordinates wrt the tetrahedron. For finding in which tetrahedron it lays I am just going by brute force and checking in all of them and returning the first tetrahedron for which `tetra.has_on_bounded_side(p) || tetra.has_on_boundary(p)` returns true.
For computing the barycentric coordinates I am solving a 4x4 equations system.
Is there any way to accelerate the tetrahedron query using an AABB. All the example i have found are only related with triangles. Also, is there any algorithm in CGAL to compute barycentric coordinates in 3D? All I've found is related with 2D.