Skip to main content

raycast_all

Function raycast_all 

Source
pub fn raycast_all(
    mesh: &Mesh,
    bvh: &Bvh,
    ray: &Ray,
    opts: &RayOptions,
    out: &mut Vec<RayHit>,
) -> Result<usize>
Expand description

Appends every hit with opts.min_t <= t <= opts.max_t to out, sorted by (t, triangle), and returns how many were appended. Elements already in out are kept.

A ray through an edge shared by several triangles, or through a vertex shared by a fan, reports one hit per triangle: a vertex shared by 6 triangles gives 6 hits at the same t. A caller that counts surface crossings, for parity or winding, must merge hits with equal t itself; the query keeps every hit so that no crossing is lost, and Phase 5’s inside/outside tests do not count ray crossings at all: they use angle-weighted pseudonormals, or generalized winding numbers where the orientation is inconsistent, neither of which needs a parity rule for duplicate hits.

§Errors

As for raycast, and QueryError::OutOfMemory when out cannot grow; on any error out keeps its original length.