Collision filter#235
Conversation
- Introduce ipc::CollisionFilter (type-erased, composable predicate) with |, &, !, |=, &= and callable construction - Add inline factories: make_vertex_patches_filter and make_static_obstacle_filter; declare make_connected_components_filter - Implement make_connected_components_filter using libigl - Wire CollisionFilter into broad_phase, CollisionMesh bindings, and CMake lists - Add Catch2 unit tests and Python tests validating filter APIs
There was a problem hiding this comment.
Pull request overview
This PR introduces a composable CollisionFilter abstraction (C++ + Python) to unify and simplify collision-pair filtering, adds several factory helpers for common scenarios, and updates tests/docs to reflect the new workflow.
Changes:
- Added a new C++
ipc::CollisionFiltertype with logical composition operators and factory helpers (make_vertex_patches_filter,make_static_obstacle_filter,make_connected_components_filter). - Updated
CollisionMesh::can_collideandBroadPhase::can_vertices_collideto useCollisionFilterinstead ofstd::function. - Added/updated C++ + Python tests and refreshed FAQ documentation with examples and new factory functions.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/src/tests/test_collision_filter.cpp | New C++ unit tests covering CollisionFilter behavior and factory helpers. |
| tests/src/tests/CMakeLists.txt | Registers the new C++ collision-filter test file. |
| src/ipc/collision_mesh.hpp | Switches CollisionMesh::can_collide to CollisionFilter. |
| src/ipc/collision_filter.hpp | Adds the CollisionFilter type and inline factory helpers. |
| src/ipc/collision_filter.cpp | Implements make_connected_components_filter via libigl connected components. |
| src/ipc/CMakeLists.txt | Adds collision filter sources to the IPC library build. |
| src/ipc/broad_phase/broad_phase.hpp | Switches BroadPhase::can_vertices_collide to CollisionFilter. |
| python/tests/test_collision_mesh.py | Updates Python tests to use new factory helpers instead of deprecated functor classes. |
| python/tests/test_collision_filter.py | Adds Python unit tests for CollisionFilter composition + factories. |
| python/src/collision_mesh.cpp | Exposes CollisionFilter + factory functions to Python; updates can_collide property behavior. |
| docs/source/tutorials/faq.rst | Rewrites FAQ collision-filtering section to describe the new composable system. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
==========================================
+ Coverage 95.74% 95.75% +0.01%
==========================================
Files 161 163 +2
Lines 16633 16650 +17
Branches 920 920
==========================================
+ Hits 15925 15944 +19
+ Misses 708 706 -2
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:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Add make_codim_cross_filter(nCV) to allow only mixed codim pairs - Change CollisionFilter callables to use size_t indices - Add implicit conversion to std::function<bool(size_t,size_t)> - Compose filter with mesh.can_collide in Candidates to skip c-vertex/c-vertex and c-edge/c-edge pairs - Add missing include and adjust lambdas accordingly
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Description
Make collision filters composable and easier to use. Add several factory functions for common filter types, and update the documentation to reflect these improvements.
CollisionFilterclass in both C++ and Python, which wraps anybool(int, int)callable and supports logical composition via|,&, and~operators.make_sparse_filter,make_vertex_patches_filter,make_static_obstacle_filter, andmake_connected_components_filterfor common collision filtering scenarios.Type of change