MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / intersects

Method intersects

nodedb-array/src/segment/mbr_index/predicate.rs:50–70  ·  view source on GitHub ↗

Does this predicate's per-dim range intersect `bbox`? True if for every dim where the predicate has a bound, the tile's [min, max] overlaps the predicate's [lo, hi]. Dims the predicate doesn't constrain are accepted by default. If the predicate has more dims than the bbox, extra dims are ignored (stale predicate after schema change → conservative pass).

(&self, bbox: &BBox)

Source from the content-addressed store, hash-verified

48 /// predicate has more dims than the bbox, extra dims are ignored
49 /// (stale predicate after schema change → conservative pass).
50 pub fn intersects(&self, bbox: &BBox) -> bool {
51 for (i, dp) in self.per_dim.iter().enumerate() {
52 if i >= bbox.arity() {
53 break;
54 }
55 if let Some(lo) = &dp.lo
56 && lt_bound(&bbox.max[i], lo)
57 {
58 return false;
59 }
60 if let Some(hi) = &dp.hi
61 && lt_bound(hi, &bbox.min[i])
62 {
63 return false;
64 }
65 // bounds equal-touching is overlap — handled by `lt_bound`
66 // returning false on equality.
67 let _ = le_bound; // keep helper compiled for future symmetric checks
68 }
69 true
70 }
71}
72
73#[cfg(test)]

Callers 1

descendMethod · 0.45

Calls 3

lt_boundFunction · 0.85
iterMethod · 0.45
arityMethod · 0.45

Tested by

no test coverage detected