Skip to main content

triangles_in

Function triangles_in 

Source
pub fn triangles_in(
    mesh: &Mesh,
    bvh: &Bvh,
    region: &Region,
    out: &mut Vec<TriangleId>,
) -> Result<usize>
Expand description

Appends to out every alive triangle that touches region (shares a point with it), and returns how many were appended. The order is unspecified. Elements already in out are kept.

The test is exact for the triangle’s surface, not its bounding box. Sphere and box overlap are both closed, so a triangle that only touches the region counts.

§Errors

QueryError::InvalidInput for a sphere with a non-finite center or a radius that is negative or not finite; then QueryError::MeshMismatch or QueryError::StaleBvh when bvh does not match the current mesh; and QueryError::OutOfMemory when out cannot grow. On any error out keeps its original length.