Skip to main content

intersecting_segments

Function intersecting_segments 

Source
pub fn intersecting_segments(
    mesh_a: &Mesh,
    bvh_a: &Bvh,
    mesh_b: &Mesh,
    bvh_b: &Bvh,
    xf: &Rigid,
    out: &mut Vec<PairSegment>,
) -> Result<usize>
Expand description

Appends the intersection segment of every intersecting triangle pair of mesh_a and mesh_b (B placed in A’s space by xf), and returns how many were appended. Elements already in out are kept and stay in front.

Unlike intersection_polylines, the segments are not welded, chained or deduplicated: each pair contributes its own entries, so callers that split triangles (like boolean operations) see every crossing. Zero-length segments (endpoints equal after the f32 cast) are skipped.

§Errors

QueryError::InvalidInput for an invalid xf (see Rigid); then QueryError::MeshMismatch or QueryError::StaleBvh when a BVH does not match its current mesh; and QueryError::OutOfMemory when out or a temporary cannot grow. On any error out keeps its original length.