Skip to content

Conversation

@zfergus
Copy link
Member

@zfergus zfergus commented Sep 2, 2025

Description

This pull request introduces a new broad phase collision detection method, LBVH (Linear Bounding Volume Hierarchy), and adds performance profiling capabilities to the project. It also includes updates to the build system and Python bindings to support these features. The most important changes are grouped below.

LBVH Broad Phase Collision Detection

  • Added implementation of the LBVH class in src/ipc/broad_phase/lbvh.hpp and corresponding source file, providing a new broad phase method for collision detection. This includes node structure, build routines, and candidate detection logic.
  • Added a Python example python/examples/lbvh.py demonstrating LBVH usage and visualization.

Performance Profiling

  • Added a new profiler utility (src/ipc/utils/profiler.cpp, src/ipc/utils/profiler.hpp) to measure and record performance metrics, with CSV output support.
  • Updated the build configuration (CMakeLists.txt, src/ipc/config.hpp.in) to allow enabling/disabling the profiler via the IPC_TOOLKIT_WITH_PROFILER option.
  • Instrumented the BVH broad phase implementation (src/ipc/broad_phase/bvh.cpp) with profiler blocks to collect timing data for key routines.

Type of change

  • Enhancement (non-breaking change which improves existing functionality)

…ing support

- Introduced LBVH class for efficient broad phase collision detection.
- Implemented LBVH node structure with AABB intersection checks.
- Added methods for detecting vertex-vertex, edge-vertex, edge-edge, face-vertex, edge-face, and face-face candidates.
- Integrated profiling functionality with IPC_TOOLKIT_WITH_PROFILER flag.
- Updated CMakeLists to include new LBVH test files and source files.
- Added tests for LBVH construction and candidate detection.
- Included Python bindings for LBVH and example usage scripts.
- Enhanced configuration options in config.hpp for profiling support.
@codecov
Copy link

codecov bot commented Sep 2, 2025

Codecov Report

❌ Patch coverage is 89.24419% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.24%. Comparing base (f6ee986) to head (b2b4f39).

Files with missing lines Patch % Lines
src/ipc/utils/profiler.cpp 9.09% 30 Missing ⚠️
src/ipc/broad_phase/lbvh.cpp 97.27% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
- Coverage   97.37%   97.24%   -0.13%     
==========================================
  Files         157      161       +4     
  Lines       24240    24590     +350     
  Branches      843      882      +39     
==========================================
+ Hits        23604    23913     +309     
- Misses        636      677      +41     
Flag Coverage Δ
unittests 97.24% <89.24%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zfergus zfergus added the enhancement New feature or request label Oct 1, 2025
Copilot AI review requested due to automatic review settings January 16, 2026 14:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a parallel CPU implementation of Linear Bounding Volume Hierarchy (LBVH) for broad-phase collision detection and adds performance profiling capabilities. The LBVH uses Morton codes for efficient spatial sorting and parallel construction.

Changes:

  • Implemented LBVH broad-phase collision detection method with parallel construction using TBB
  • Added profiler utility with CSV export and optional compilation via CMake flag
  • Integrated profiling blocks into BVH and LBVH implementations

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/ipc/broad_phase/lbvh.hpp Defines LBVH class with Node structure and detection methods
src/ipc/broad_phase/lbvh.cpp Implements LBVH construction using Morton codes and parallel traversal
src/ipc/utils/profiler.hpp Profiler header with timing macros and data structures
src/ipc/utils/profiler.cpp Profiler implementation with CSV export functionality
tests/src/tests/broad_phase/test_lbvh.cpp Test cases for LBVH construction and candidate detection
python/examples/lbvh.py Python example demonstrating LBVH visualization
CMakeLists.txt Adds profiler option and nlohmann/json dependency
.github/workflows/python.yml Updates Python version to 3.14
.clang-format Removes Language and RemoveEmptyLinesInUnwrappedLines options

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants