I am using CGAL for a project of mine. I create a AABB tree out of a mesh file (.off). First I extract Polyhedron from my mesh, then I get the triangles and finally I insert them in the tree. All of this went smoothly.
The problem is when I use the do_intersect function of the tree. Given two points, A and B, I would like to know if the ray or segment connecting the two insersect with something.
Most of the time this works properly, sometimes I get the floating point error. 'sometimes' means with a very few subsets of points.
Is there a reason for this?
Here there is a snippet of my code:
glm::vec3 pointA, pointB; // assume this are filled with some values
// the elements inside points above are floats.
Point_3 pA(pointA.x, pointA.y, pointA.z);
Point_3 pB(pointB.x, pointB.y, pointB.z);
Segment segment_query(pA, pB);
my_tree->do_intersect(segment_query); // here sometimes crashes
Before anybody asks pointB is a specific point on the surface of the mesh and it does not give any problems with most of points so I would assume the error is not related to it. Instead pointA is somewhere in the space.
Thank you for you answers.