Skip to main content

intersects

Function intersects 

Source
pub fn intersects(
    mesh_a: &Mesh,
    bvh_a: &Bvh,
    mesh_b: &Mesh,
    bvh_b: &Bvh,
    xf: &Rigid,
) -> Result<bool>
Expand description

Whether any alive triangle of A intersects or touches any alive triangle of B, with B placed in A’s space by xf.

The test is closed and exact for B’s vertices as transformed by xf in f64: touching at a single point counts, a gap of one f64 ulp does not. The search stops at the first intersecting pair found.

Passing the same mesh and BVH as both A and B means two coincident copies of it, not one mesh tested against itself: with Rigid::IDENTITY every triangle intersects its own copy, so the result is true for any mesh with a triangle.

§Errors

QueryError::InvalidInput when xf is not a finite proper rotation plus translation (see Rigid); then QueryError::MeshMismatch or QueryError::StaleBvh when bvh_a or bvh_b does not match its current mesh.