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

Function tile_overlaps_slice

nodedb-array/src/query/slice.rs:68–87  ·  view source on GitHub ↗

True if a tile's per-dim MBR overlaps every constrained dim range. An empty `dim_ranges` (no constraints) trivially overlaps.

(
    dim_mins: &[DomainBound],
    dim_maxs: &[DomainBound],
    slice: &Slice,
)

Source from the content-addressed store, hash-verified

66/// True if a tile's per-dim MBR overlaps every constrained dim range.
67/// An empty `dim_ranges` (no constraints) trivially overlaps.
68pub fn tile_overlaps_slice(
69 dim_mins: &[DomainBound],
70 dim_maxs: &[DomainBound],
71 slice: &Slice,
72) -> bool {
73 for (i, range) in slice.dim_ranges.iter().enumerate() {
74 let Some(r) = range else { continue };
75 let Some(tile_min) = dim_mins.get(i) else {
76 return false;
77 };
78 let Some(tile_max) = dim_maxs.get(i) else {
79 return false;
80 };
81 // Disjoint when tile_max < range.lo OR tile_min > range.hi.
82 if bound_lt(tile_max, &r.lo) || bound_lt(&r.hi, tile_min) {
83 return false;
84 }
85 }
86 true
87}
88
89/// Filter cells in `tile` to those whose coords pass every dim range.
90/// Result is a freshly-built [`SparseTile`] — dictionaries shrink to

Calls 3

bound_ltFunction · 0.85
iterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected