Possibility of fast evaluation of whether a point lies inside the bound volume
Closed this issue · 1 comments
pyenthu commented
Is there a way to quickly find whether a point lies inside a mesh with the BVH structure?
The aim is to iterate the vertices of and intersection mesh without actually doing a Boolean operation. If they lie within the mesh then I just need a true or a false.
This would need to be done fast and nearly real time.
gkjohnson commented
This is more related to three-mesh-bvh than CSG. But you can use a raycast to determine whether a point is inside a mesh as long as it's solid and two-manifold. See these lines from the voxelization example:
// If we hit a face backside we know we're inside the mesh. Alternatively we
// could check if we hit an odd number of faces when checking all intersections.
const res = bvh.raycastFirst( ray, 2 );
if ( res && res.face.normal.dot( ray.direction ) > 0.0 ) {
// point is inside
}