Skip to content

Conversation

@zfergus
Copy link
Member

@zfergus zfergus commented Aug 18, 2025

Description

This pull request introduces support for rigid body dynamics simulation.

Rigid body dynamics support in Python bindings

  • Added a new dynamics module with subfolder rigid, including Simulator, RigidBodies, Pose, and Poses classes, and exposed them via pybind11 in the Python bindings

Improvements to CMake dependency management

  • Updated CPM versions and refactored third-party recipes to use the OPTIONS argument for configuration, improving clarity and maintainability.
  • Added a new CMake recipe for TinyGLTF and integrated it into the build.

Python usability improvements and new examples

  • Added a new example script demonstrating rigid body simulation and visualization using ipctk, meshio, and polyscope (python/examples/rigid.py).

Minor Python binding improvements

  • Changed save_obj method to write_obj in Candidates Python bindings for clarity.
  • Made CollisionMesh Python class use std::shared_ptr for better memory management.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

zfergus and others added 17 commits May 31, 2024 00:41
- Added InertialTerm class for computing energy, gradient, and Hessian of rigid bodies.
- Implemented mass properties computation for 2D and 3D meshes, including point clouds.
- Created pose representation with rotation vector and matrix conversions.
- Developed RigidBodies class to manage multiple rigid bodies from mesh data.
- Implemented ImplicitEuler time integrator for updating positions and velocities.
- Added unit tests for mass properties and pose transformations using Catch2 framework.
- Updated finite-diff package from version 1.0.1 to 1.0.3 in CMake configuration.
- Remove template from Pose.
- Modified RigidBody and related classes to use the updated Pose structure.
- Added unit tests for RigidBody construction and transformations.
- Update CPM to 0.42.0
- Add TinyGLTF dependency
- Rename save_obj to write_candidates_obj
- Add write_gltf
@zfergus zfergus added the enhancement New feature or request label Aug 18, 2025
@zfergus zfergus added this to the v1.5.0 milestone Aug 18, 2025
@codecov
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

❌ Patch coverage is 50.30675% with 486 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.23%. Comparing base (893dbf2) to head (ebf466f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ipc/io/write_gltf.cpp 0.00% 164 Missing ⚠️
src/ipc/dynamics/rigid/simulator.cpp 0.00% 78 Missing ⚠️
src/ipc/dynamics/rigid/body_forces.cpp 0.00% 72 Missing ⚠️
...rc/ipc/dynamics/affine/orthogonality_potential.cpp 36.58% 52 Missing ⚠️
src/ipc/dynamics/rigid/mass.cpp 67.10% 50 Missing ⚠️
src/ipc/dynamics/rigid/time_integrator.hpp 46.15% 21 Missing ⚠️
src/ipc/dynamics/rigid/inertial_term.cpp 84.70% 13 Missing ⚠️
src/ipc/candidates/candidates.cpp 0.00% 9 Missing ⚠️
src/ipc/dynamics/rigid/rigid_bodies.hpp 18.18% 9 Missing ⚠️
src/ipc/dynamics/rigid/rigid_body.cpp 89.47% 6 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #184      +/-   ##
==========================================
- Coverage   96.96%   95.23%   -1.74%     
==========================================
  Files         161      179      +18     
  Lines       24747    25710     +963     
  Branches      893      981      +88     
==========================================
+ Hits        23997    24484     +487     
- Misses        750     1226     +476     
Flag Coverage Δ
unittests 95.23% <50.30%> (-1.74%) ⬇️

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.

- Introduce new overloads for build methods across various classes, allowing for the use of precomputed AABBs.
- Update related documentation and ensure consistent handling of vertex boxes and edges.
- Improve voxel size suggestion logic based on bounding box dimensions.
@zfergus zfergus removed this from the v1.5.0 milestone Jan 26, 2026
Move sinc implementation from ipc/utils to ipc/math and update CMake.
Replace includes of ipc/utils/interval.hpp with ipc/math/interval.hpp.
Expose NonlinearCCD constructor and properties in Python bindings and
adjust tests accordingly. Rename candidates::save_obj to write_obj and
add missing ipc/geometry/normal.hpp includes where required.
- Reorder conservative_piecewise_linear_ccd parameters so min_distance
  comes before tmax, rename the intermediate min_distance to
  min_distance_linear to avoid confusion/shadowing, and update all
  call-sites accordingly.
- Also remove an overly restrictive assertion in
  HashGrid::resize that limited the grid size.
- Rename BodyForces parameters (force/torque -> q_hat/Q_hat).
- Add const qualifiers to InertialTerm methods.
- Take RigidBodies shared_ptr and the Simulator callback by reference.
- Add linter NOLINT annotations, remove an unused include, replace/tidy
  sinc taylor bound constants, and fix RigidBodies initializer and
  RigidBody enum underlying type.
- q_hat and Q_hat should be force and torque in BodyForces
Replace many Eigen vector/matrix parameters with Eigen::ConstRef to
avoid unnecessary copies and clarify ownership. Also add const
correctness to various methods (e.g. BodyForces operator(), gradient),
rename forces/torques to m_forces/m_torques, add test_body_forces.
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