Far-Beyond-Dev / Far-Beyond-Dev/PebbleVault

Add Size-Aware Region Querying to VaultManager

Open
#13 1 comment 0 reactions 1 assignee Claimed by @justinpitera View on GitHub
enhancement
Dominant language
Rust
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### Feature Request: Add Size-Aware Region Querying to VaultManager

**Summary:**
Currently, `query_region` only checks whether an object’s center point is within the query bounds. This can produce incorrect results when objects have a nontrivial size (e.g., a large object with a center outside the box but overlapping it). We should implement **size-aware querying** using AABB (Axis-Aligned Bounding Box) intersection logic.

---

### Acceptance Criteria

* [ ] Update `VaultManager::query_region` to consider each object's size when determining overlap.
* [ ] Use bounding-box intersection logic instead of point-in-box.
* [ ] Add unit tests for:

* Object entirely inside the box
* Object partially intersecting the box
* Object completely outside the box
* [ ] Ensure results are consistent with persisted `size_x`, `size_y`, `size_z` values.

---

### Resources / Notes

* Object bounds = `[x - size_x/2, x + size_x/2]` (and same for `y`, `z`)
* Region query bounds are already passed as min/max (or derived from center + size).
* Consider moving bounding-box intersection logic into a helper like `fn intersects(a_min, a_max, b_min, b_max) -> bool`.

---

### Optional Improvements

* Extend RTree to store object envelopes (`impl RTreeObject for SpatialObject`)
* Improve `query_region` performance via envelope-based search (if RTree supports it)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.