Skip to content

Add analytic plane-vertex collision support#216

Merged
zfergus merged 5 commits intomainfrom
plane-point-contact
Feb 28, 2026
Merged

Add analytic plane-vertex collision support#216
zfergus merged 5 commits intomainfrom
plane-point-contact

Conversation

@zfergus
Copy link
Member

@zfergus zfergus commented Feb 28, 2026

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

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

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.
Copilot AI review requested due to automatic review settings February 28, 2026 15:22
@zfergus zfergus added the enhancement New feature or request label Feb 28, 2026
@zfergus zfergus added this to the v1.6.0 milestone Feb 28, 2026
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

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), and PlaneVertexTangentialCollision, and integrate PV into Candidates, NormalCollisions, and TangentialCollisions.
  • Add CollisionMesh::planes (vector of Eigen::Hyperplane<double,3>) and Python bindings for Hyperplane plus 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
Copy link

codecov bot commented Feb 28, 2026

Codecov Report

❌ Patch coverage is 96.52778% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.18%. Comparing base (08a059c) to head (9d4f28a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ipc/candidates/face_vertex.hpp 0.00% 1 Missing ⚠️
src/ipc/candidates/plane_vertex.cpp 97.50% 1 Missing ⚠️
src/ipc/candidates/plane_vertex.hpp 75.00% 1 Missing ⚠️
src/ipc/collisions/normal/plane_vertex.hpp 75.00% 1 Missing ⚠️
src/ipc/collisions/tangential/plane_vertex.hpp 0.00% 1 Missing ⚠️
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     
Flag Coverage Δ
unittests 97.18% <96.52%> (+0.27%) ⬆️

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.

@ipc-sim ipc-sim deleted a comment from Copilot AI Feb 28, 2026
@ipc-sim ipc-sim deleted a comment from Copilot AI Feb 28, 2026
@ipc-sim ipc-sim deleted a comment from Copilot AI Feb 28, 2026
@ipc-sim ipc-sim deleted a comment from Copilot AI Feb 28, 2026
@ipc-sim ipc-sim deleted a comment from Copilot AI Feb 28, 2026
@zfergus zfergus merged commit 8016f25 into main Feb 28, 2026
21 checks passed
@zfergus zfergus deleted the plane-point-contact branch February 28, 2026 17:24
zfergus added a commit that referenced this pull request Feb 28, 2026
* 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
zfergus added a commit that referenced this pull request Mar 1, 2026
* 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.
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