Add analytic plane-vertex collision support#216
Conversation
Integrate analytic plane-vertex primitives into the collision pipeline. Add PlaneVertexCandidate, normal and tangential plane-vertex collisions, and pv handling in builders. Add CollisionMesh::planes and Python bindings (Hyperplane, PlaneVertex*). Remove old implicits module and update CMake, tests, and small API/format fixes.
There was a problem hiding this comment.
Pull request overview
Integrates analytic plane–vertex primitives into the IPC collision pipeline by introducing plane–vertex candidates/collisions (normal + tangential), wiring them into builders, and exposing planes on CollisionMesh (with Python bindings), while removing the legacy implicits plane module.
Changes:
- Add
PlaneVertexCandidate,PlaneVertexNormalCollision(refactor), andPlaneVertexTangentialCollision, and integrate PV intoCandidates,NormalCollisions, andTangentialCollisions. - Add
CollisionMesh::planes(vector ofEigen::Hyperplane<double,3>) and Python bindings forHyperplaneplus PV candidate/collision bindings. - Remove the old
ipc/implicits(C++ + Python) and tighten warnings / fix extra semicolons.
Reviewed changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/src/tests/distance/test_point_plane.cpp | Remove extra semicolon to satisfy -Werror=extra-semi. |
| tests/src/tests/distance/test_edge_edge.cpp | Remove extra semicolon to satisfy -Werror=extra-semi. |
| tests/src/tests/collisions/test_normal_collisions.cpp | Update PV normal-collision tests to use Eigen::Hyperplane. |
| tests/src/tests/candidates/test_normals.cpp | Update PV normal-collision construction API in tests. |
| tests/src/tests/candidates/test_coefficients.cpp | Update PV normal-collision construction API in tests. |
| src/ipc/utils/eigen_ext.hpp | Remove extra semicolon at EIGEN_USING_STD(abs) site. |
| src/ipc/utils/CMakeLists.txt | Reorder/add sources; currently duplicates autodiff_types.hpp. |
| src/ipc/smooth_contact/primitives/point3.hpp | Switch direction parameter to Eigen::ConstRef<VectorMax3d>. |
| src/ipc/smooth_contact/primitives/point3.cpp | Match updated Point3 constructor signature. |
| src/ipc/smooth_contact/primitives/point2.hpp | Switch direction parameter to Eigen::ConstRef<VectorMax3d>. |
| src/ipc/smooth_contact/primitives/point2.cpp | Match updated Point2 constructor signature. |
| src/ipc/smooth_contact/primitives/face.hpp | Switch direction parameter to Eigen::ConstRef<VectorMax3d>. |
| src/ipc/smooth_contact/primitives/face.cpp | Match updated Face constructor signature. |
| src/ipc/smooth_contact/primitives/edge3.hpp | Switch direction parameter to Eigen::ConstRef<VectorMax3d>. |
| src/ipc/smooth_contact/primitives/edge3.cpp | Match updated Edge3 constructor signature. |
| src/ipc/smooth_contact/primitives/edge2.hpp | Switch direction parameter to Eigen::ConstRef<VectorMax3d>. |
| src/ipc/smooth_contact/primitives/edge2.cpp | Match updated Edge2 constructor signature. |
| src/ipc/smooth_contact/primitives/edge.hpp | Switch direction parameter to Eigen::ConstRef<VectorMax3d>. |
| src/ipc/smooth_contact/primitives/edge.cpp | Match updated Edge<DIM> constructor signature. |
| src/ipc/potentials/potential.cpp | Replace sum lambda with std::plus<double>() in parallel_reduce. |
| src/ipc/implicits/plane.hpp | Deleted legacy point–plane helper API. |
| src/ipc/implicits/plane.cpp | Deleted legacy point–plane helper implementation. |
| src/ipc/implicits/CMakeLists.txt | Remove implicits subtarget. |
| src/ipc/collisions/tangential/tangential_collisions.hpp | Add PV tangential collision container. |
| src/ipc/collisions/tangential/tangential_collisions.cpp | Build/store PV tangential collisions; update indexing/size/clear. |
| src/ipc/collisions/tangential/plane_vertex.hpp | New PV tangential collision type. |
| src/ipc/collisions/tangential/plane_vertex.cpp | New PV tangential collision implementation. |
| src/ipc/collisions/tangential/CMakeLists.txt | Add PV tangential sources. |
| src/ipc/collisions/normal/plane_vertex.hpp | Refactor PV normal collision to reuse PlaneVertexCandidate. |
| src/ipc/collisions/normal/plane_vertex.cpp | Deleted old PV normal collision implementation (moved to candidate). |
| src/ipc/collisions/normal/normal_collisions.cpp | Add PV normal collision construction from PV candidates. |
| src/ipc/collisions/normal/CMakeLists.txt | Remove deleted plane_vertex.cpp from build. |
| src/ipc/collision_mesh.hpp | Add CollisionMesh::planes. |
| src/ipc/ccd/point_static_plane.cpp | Remove extra semicolon to satisfy -Werror=extra-semi. |
| src/ipc/candidates/vertex_vertex.hpp | Remove extra semicolon to satisfy -Werror=extra-semi. |
| src/ipc/candidates/plane_vertex.hpp | New PV candidate stencil. |
| src/ipc/candidates/plane_vertex.cpp | New PV candidate distance/ccd implementation. |
| src/ipc/candidates/face_vertex.hpp | Remove extra semicolon to satisfy -Werror=extra-semi. |
| src/ipc/candidates/edge_vertex.hpp | Remove extra semicolon to satisfy -Werror=extra-semi. |
| src/ipc/candidates/edge_edge.hpp | Remove extra semicolon to satisfy -Werror=extra-semi. |
| src/ipc/candidates/candidates.hpp | Add PV candidate list. |
| src/ipc/candidates/candidates.cpp | Generate PV candidates from CollisionMesh::planes. |
| src/ipc/candidates/CMakeLists.txt | Enable compilation of PV candidate sources. |
| src/ipc/CMakeLists.txt | Remove implicits subdirectory. |
| python/src/implicits/plane.cpp | Remove Python bindings for deleted implicits API. |
| python/src/implicits/bindings.hpp | Remove implicits binding declarations. |
| python/src/implicits/CMakeLists.txt | Remove implicits Python subtarget. |
| python/src/collisions/tangential/plane_vertex.cpp | New Python binding for PV tangential collision. |
| python/src/collisions/tangential/bindings.hpp | Add PV tangential collision binding declaration. |
| python/src/collisions/tangential/CMakeLists.txt | Add PV tangential collision binding source. |
| python/src/collisions/normal/plane_vertex.cpp | Update PV normal collision Python binding to use Hyperplane. |
| python/src/collision_mesh.cpp | Bind Eigen::Hyperplane as Hyperplane; expose CollisionMesh.planes. |
| python/src/candidates/plane_vertex.cpp | New Python binding for PV candidate. |
| python/src/candidates/candidates.cpp | Expose pv_candidates to Python. |
| python/src/candidates/bindings.hpp | Add PV candidate binding declaration. |
| python/src/candidates/CMakeLists.txt | Add PV candidate binding source. |
| python/src/bindings.hpp | Remove implicits include. |
| python/src/bindings.cpp | Register PV candidate/tangential bindings; remove implicits registration. |
| python/src/CMakeLists.txt | Remove implicits Python subdirectory. |
| cmake/recipes/eigen.cmake | Set Eigen include dirs as system include via target properties. |
| cmake/ipc_toolkit/ipc_toolkit_warnings.cmake | Add -Werror=extra-semi. |
💡 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 #216 +/- ##
==========================================
+ Coverage 96.90% 97.18% +0.27%
==========================================
Files 158 160 +2
Lines 24675 24721 +46
Branches 886 889 +3
==========================================
+ Hits 23911 24024 +113
+ Misses 764 697 -67
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 <175728472+Copilot@users.noreply.github.com>
…l collision calculations
…ate documentation
* Integrate analytic plane-vertex primitives into the collision pipeline. * Add PlaneVertexCandidate, normal and tangential plane-vertex collisions, and pv handling in builders. * Add CollisionMesh::planes and Python bindings (Hyperplane, PlaneVertex*). * Remove old implicits module and update CMake, tests, and small API/format fixes. * Refactor conservative rescaling initialization in CCD classes and update documentation
* Support configurable vertex derivative layout Add a VERTEX_DERIVATIVE_LAYOUT constant to ipc::config and include Eigen. Update local_to_global.hpp to parameterize all assembly helpers (gradient, sparse gradient, Hessian triplets, Jacobian triplets, MatrixCache Hessian) with an optional GlobalOrder template (defaulting to VERTEX_DERIVATIVE_LAYOUT). Implement both RowMajor and ColMajor indexing code paths and add static_asserts and detailed doc comments. Also include ipc/config.hpp, convert LocalThreadMatStorage to a struct with docs, and adjust MatrixCache-based hessian assembly to respect the chosen global ordering. * Add barrier stiffness and simplify tangential API (#215) * Add barrier stiffness and simplify tangential API Introduce a barrier stiffness (kappa) to BarrierPotential: new constructors, member, getters/setters, and scale operator/gradient/hessian by stiffness. Remove the redundant normal_stiffness parameter from tangential collision constructors and tangential potential interfaces, updating all call sites, headers, and implementations accordingly. Update Python bindings, tutorials, examples (ogc, solver), and tests (test_ipc) to match the new API and default stiffness usage; also move a notebook to python/examples. Miscellaneous formatting/import cleanups and adjustments to pybind argument lists to reflect the simplified tangential API. * Remove assert(false) if the meshes has non-manifold edges * Add alias for Eigen::last = Eigen::indexing::last * Apply EIGEN_DONT_VECTORIZE to ipc_toolkit Disable Eigen vectorization to avoid alignment issues. Place EIGEN_DONT_VECTORIZE on the ipc_toolkit target as PUBLIC because setting it on the Eigen target or making it PRIVATE caused crashes. * Fix friction force jacobian tests * Handle single-node LBVH in broad-phase queries Detect lbvh.size() == 1 and treat the root as a leaf in both single and batched query traversals, performing intersection tests and adding candidate collisions as appropriate * Add as<T> cast helpers to CollisionStencil * Add analytic plane-vertex collision support (#216) * Integrate analytic plane-vertex primitives into the collision pipeline. * Add PlaneVertexCandidate, normal and tangential plane-vertex collisions, and pv handling in builders. * Add CollisionMesh::planes and Python bindings (Hyperplane, PlaneVertex*). * Remove old implicits module and update CMake, tests, and small API/format fixes. * Refactor conservative rescaling initialization in CCD classes and update documentation * Apply suggestions from code review * Handle ColMajor global ordering in local_to_global Use total global vertex/row/col counts when computing column-major indices and validate buffer sizes. Add optional n_total_verts, n_total_rows and n_total_cols parameters (default -1) that are required for ColMajor storage and throw an error if omitted. Include logger header, assert grad size divisibility, and update MatrixCache/triplet indexing accordingly. Add test_local_to_global.cpp to tests CMakeLists. * Add braces to nested loops in test * Support ColMajor DOF layout in derivatives and tests Add tests/dof_layout.hpp with helpers to flatten, unflatten, and reorder gradients/hessians so finite-difference tests work for both VERTEX_DERIVATIVE_LAYOUT settings. Pass mesh.num_vertices() (n_total_verts) into shape_derivative and local_*_to_global_triplets so global DOF indices are computed correctly for column-major layouts. * Support vertex-to-dof matrix layout and tests Use VERTEX_DERIVATIVE_LAYOUT to map vertex-level sparse matrices into per-dof sparse matrices, computing triplets with n_rows/n_cols and constructing M_dof with the correct dimensions. Move the function declaration in the header and add unit tests (including Catch2 generators and config include) that verify sparsity pattern and the M_dof * x == flatten(M_V * V) semantics. * Add configurable vertex derivative layout option Introduce IPC_TOOLKIT_VERTEX_DERIVATIVE_LAYOUT CMake cache option (default RowMajor) with allowed values ColMajor and RowMajor, and mark it advanced. Export the value into src/ipc/config.hpp.in so VERTEX_DERIVATIVE_LAYOUT is set to the chosen Eigen layout at configure time. * Add vertex derivative layout docs Describe row-major default and new CMake cache option IPC_TOOLKIT_VERTEX_DERIVATIVE_LAYOUT (RowMajor or ColMajor), with build examples, affected APIs, and an experimental feature warning.
Description
Integrate analytic plane-vertex primitives into the collision pipeline. Add PlaneVertexCandidate, normal and tangential plane-vertex collisions, and PV handling in builders. Add CollisionMesh::planes and Python bindings (Hyperplane, PlaneVertex*). Remove old implicits module and update CMake, tests, and small API/format fixes.
Type of change