Closed Sir-Goshawk closed 9 months ago
RustBCA determines if a point is inside a trimesh in a similar way to the ray casting solution to the point-in-polygon problem.
First, it checks if the point is inside the bounding box volume of the mesh. If so, it then raycasts in an arbitrary direction, in this case (1.0, 0.0, 0.0). If there are no intersections with the mesh, it is outside the mesh. If there are, it then determines if the first face intersected by that ray is an inside face or an outside face by comparing the direction of the normal to the direction of the ray. This is where the code will break when normals are not all outward-facing.
If the mesh is not watertight, there may be regions of the interior where this ray fails to intersect with the trimesh even for points inside the mesh, resulting in erroneous "not inside" determinations. Hope this helps!
I see, thank you.
Does it affect the
inside_trimesh
function or other logical as well?