Skip to content

Conversation

@zfergus
Copy link
Member

@zfergus zfergus commented Oct 2, 2025

Description

Implementation of "Offset Geometric Contact" [Chen et al. 2025].

Details

This PR implements the Offset Geometric Contact (OGC) algorithm [Chen et al. 2025], a penetration-free contact model that replaces continuous collision detection (CCD) with a trust-region-based approach.

1. Core Library (src/ipc/ogc/)

  • New Namespace: Introduced ipc::ogc to encapsulate OGC-specific functionality.
  • Trust Region Implementation:
    • Added TrustRegion class (trust_region.hpp, trust_region.cpp) to manage per-vertex conservative bounds.
    • Implemented warm_start_time_step to initialize the trust region and handle initial predictions.
    • Implemented filter_step to scale optimization steps ensuring vertices stay within safe bounds.
    • Implemented update and update_if_needed to dynamically resize trust regions based on motion.
  • Feasible Region Logic:
    • Added feasible_region.hpp and feasible_region.cpp containing geometric predicates (e.g., check_vertex_feasible_region, is_edge_edge_feasible) to verify if primitives are within valid non-penetrating regions.

2. Python Bindings (python/src/ogc/)

  • Exposed the OGC functionality to Python via the ipctk.ogc module.
  • Added bindings for TrustRegion and related classes, allowing seamless integration with Python-based optimization loops.

3. Documentation (docs/)

  • New Tutorial: Added a comprehensive tutorial (docs/source/tutorials/ogc.rst) explaining:
    • The high-level OGC algorithm.
    • How to configure NormalCollisions for OGC.
    • Step-by-step integration of the TrustRegion class into a simulation loop (C++ and Python).
  • Configuration: Updated docs/source/conf.py to support new documentation features.

4. Build System

  • Updated CMake configuration to include the new ogc source directory and dependencies.
  • Mark tsl::robin_map and absl::hash as private dependencies in CMake. Update the dependency documentation accordingly.
  • Convert SpatialHash to PImpl idiom to hide tsl::robin_map and absl::hash from the public API.

Key Implementation Details

  • Step Scaling: Unlike the original paper's projection method, TrustRegion::filter_step scales the descent direction $\beta$ to keep vertices on the trust region boundary. This preserves the descent direction, ensuring compatibility with line-search-based solvers.

Type of change

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

@zfergus zfergus added this to the v1.5.0 milestone Oct 2, 2025
@zfergus zfergus added the enhancement New feature or request label Oct 2, 2025
@zfergus zfergus requested a review from Copilot October 2, 2025 20:24
@codecov
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 96.30996% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.38%. Comparing base (6e2fd31) to head (2a553dc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ipc/ogc/trust_region.cpp 90.66% 7 Missing ⚠️
...pc/collisions/normal/normal_collisions_builder.cpp 87.23% 6 Missing ⚠️
src/ipc/collision_mesh.hpp 71.42% 4 Missing ⚠️
src/ipc/barrier/barrier.hpp 0.00% 2 Missing ⚠️
src/ipc/candidates/candidates.cpp 99.03% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #192      +/-   ##
==========================================
- Coverage   97.42%   97.38%   -0.05%     
==========================================
  Files         153      157       +4     
  Lines       23917    24240     +323     
  Branches      804      844      +40     
==========================================
+ Hits        23301    23605     +304     
- Misses        616      635      +19     
Flag Coverage Δ
unittests 97.38% <96.30%> (-0.05%) ⬇️

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.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@zfergus zfergus requested a review from Copilot October 3, 2025 00:39
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

Copilot reviewed 39 out of 42 changed files in this pull request and generated 6 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@zfergus zfergus marked this pull request as ready for review October 4, 2025 18:56
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

Copilot reviewed 74 out of 77 changed files in this pull request and generated 6 comments.


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

@zfergus zfergus merged commit 90b7caf into main Jan 15, 2026
26 of 27 checks passed
@zfergus zfergus deleted the ogc branch January 15, 2026 22:32
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