pub fn intersection_polylines(
mesh_a: &Mesh,
bvh_a: &Bvh,
mesh_b: &Mesh,
bvh_b: &Bvh,
xf: &Rigid,
out: &mut Vec<Polyline>,
) -> Result<usize>Expand description
Appends to out the polylines where mesh_a and mesh_b (placed in A’s
space by xf) intersect, and returns how many were appended. Elements
already in out are kept and stay in front.
A pair of triangles that only touch at a point contributes no segment;
coplanar pairs contribute only area overlaps, as their boundary
(interior edges shared by two pairs cancel; a touch along an edge or at
a point contributes nothing); a degenerate triangle contributes the
overlap of its longest edge. Segments are welded by exact f32 equality:
endpoints computed from the same edge and plane are bit-identical, and
endpoints on a shared vertex snap to it exactly, so loops close.
The order is deterministic: open polylines first, each from its smaller end, then closed loops, each from its smallest point; each group is sorted by first point.
§Errors
QueryError::InvalidInput for an invalid xf (see Rigid); then
QueryError::MeshMismatch or QueryError::StaleBvh when a BVH does
not match its mesh; and QueryError::OutOfMemory when out or a
temporary cannot grow. On any error out keeps its original length.