pub struct ClashSession { /* private fields */ }Expand description
A clash session: stores per-element geometry, element AABBs, and caches the per-element triangle BVHs that the narrow phase needs.
Implementations§
Source§impl ClashSession
impl ClashSession
pub fn new() -> Self
Sourcepub fn ingest(
&mut self,
positions: &[f32],
pos_ranges: &[u32],
indices: &[u32],
idx_ranges: &[u32],
aabbs: &[f32],
)
pub fn ingest( &mut self, positions: &[f32], pos_ranges: &[u32], indices: &[u32], idx_ranges: &[u32], aabbs: &[f32], )
Ingest N elements from flat arenas.
positions: concatenated per-element vertex coords (x, y, z, ...).pos_ranges: 2 per element =[float_offset, float_len].indices: concatenated per-element LOCAL (0-based within that element’s vertices) triangle indices.idx_ranges: 2 per element =[idx_offset, idx_len].aabbs: 6 per element =[minx, miny, minz, maxx, maxy, maxz].
Vertex/AABB coords are f32-sourced; they are stored and computed in
f64.
Sourcepub fn run_rule(
&self,
group_a: &[u32],
group_b: Option<&[u32]>,
mode: u8,
tolerance: f64,
clearance: f64,
report_touch: bool,
) -> RuleResult
pub fn run_rule( &self, group_a: &[u32], group_b: Option<&[u32]>, mode: u8, tolerance: f64, clearance: f64, report_touch: bool, ) -> RuleResult
Run one rule.
group_a / group_b are GLOBAL element indices. group_b is
None for a self-clash within group_a (pairs with i < j by
position in group_a), and Some for a two-sided rule. Some(&[])
is a two-sided rule whose B side matched nothing, and yields no
pairs – it is NOT a self-clash (#5354).
The distinction has to be carried in the type: encoding self-clash as
an empty group_b made “the caller named a B side that matched
nothing” and “the caller named no B side” the same call, so a rule
filtered down to an empty B silently ran as A-vs-A.
mode: 0 = hard, 1 = clearance. Records carry GLOBAL element
indices.
Sourcepub fn run_rule_with_depth_floors(
&self,
group_a: &[u32],
group_b: Option<&[u32]>,
mode: u8,
tolerance: f64,
clearance: f64,
report_touch: bool,
) -> (RuleResult, Vec<Option<f64>>)
pub fn run_rule_with_depth_floors( &self, group_a: &[u32], group_b: Option<&[u32]>, mode: u8, tolerance: f64, clearance: f64, report_touch: bool, ) -> (RuleResult, Vec<Option<f64>>)
Self::run_rule, plus one entry per record: for a Hard record, the
f32 noise floor of its distance along the direction that depth was
measured — the depth at or below which the pair would have been
Touch (the classification floor, #5405). None for every other
status. A consumer deciding whether a reported clash is “really a
contact” (#5639) applies this same floor instead of re-deriving a band
from the record’s coordinates. A separate method, not a
ClashRecord field, so the public record type does not change shape.