Add Rightmost-Leaf Pruning to LBVH Traversal#222
Conversation
Use RightmostLeaves to skip subtrees fully left of a query during triangular (self-collision) traversal. Propagate the structure through init_bvh, traversal routines (including SIMD), detect_candidates, and clear(). Also adjust attempt_add_candidate and add a benchmark test for edge-edge candidate detection.
There was a problem hiding this comment.
Pull request overview
This PR introduces “rightmost leaf” metadata in the LBVH to accelerate triangular/self-collision traversal by pruning subtrees that are entirely left of the current query leaf, and wires that data through BVH construction, traversal (including SIMD), candidate detection, and clear(). It also adds a Catch2 benchmark for edge-edge candidate detection on several benchmark scenes.
Changes:
- Add
RightmostLeavesstorage to LBVH and compute/populate it duringinit_bvh(). - Use
rightmost_leavesduring triangular traversal to cull subtrees and remove the old(i >= j)triangular filter inattempt_add_candidate(). - Add a new Catch2 benchmark test case for
LBVH::detect_edge_edge_candidates.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tests/src/tests/broad_phase/test_lbvh.cpp | Adds a new benchmark test case for edge-edge candidate detection. |
| src/ipc/broad_phase/lbvh.hpp | Extends the LBVH API/data members to carry RightmostLeaves and updates traversal/detection signatures. |
| src/ipc/broad_phase/lbvh.cpp | Computes RightmostLeaves, uses it for triangular pruning in scalar/SIMD traversal, and clears the new buffers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Correct vertex indices passed to point_edge_closest_point and check_vertex_feasible_region in is_edge_edge_feasible. Previously the EA/EB vertex arguments were swapped, causing incorrect closest-point computations and feasibility checks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #222 +/- ##
=======================================
Coverage 97.20% 97.20%
=======================================
Files 160 160
Lines 24906 24926 +20
Branches 897 899 +2
=======================================
+ Hits 24209 24229 +20
Misses 697 697
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Use RightmostLeaves to skip subtrees fully left of a query during triangular (self-collision) traversal. Propagate the structure through init_bvh, traversal routines (including SIMD), detect_candidates, and clear(). Also, adjust attempt_add_candidate and add a benchmark test for edge-edge candidate detection.
This results in an 39% average speed-up in edge-edge traversal on benchmark scenes.
🐛 OGC Edge-Edge Feasibility
Also, fix three bugs in the OGC feasibility of an edge-edge pair.
Type of change