Skip to content

Fix edge-edge parallelism threshold and add regression test#225

Merged
zfergus merged 4 commits intomainfrom
fix/ee-parallel-threshold
Apr 21, 2026
Merged

Fix edge-edge parallelism threshold and add regression test#225
zfergus merged 4 commits intomainfrom
fix/ee-parallel-threshold

Conversation

@zfergus
Copy link
Copy Markdown
Member

@zfergus zfergus commented Apr 20, 2026

Description

  • Use a relative PARALLEL_THRESHOLD in edge_edge_distance_type to correctly classify nearly-collinear coplanar edges, preventing zero-distance errors
  • Add defensive guards in NormalPotential gradient/hessian for mollified collisions at d=0 to avoid assertion failures
  • Add regression test for coplanar near-collinear non-overlapping edges
  • Minor test cleanups for clarity and consistency
  • Add CLAUDE.md to .gitignore

Type of change

  • Bug fix (non-breaking change which fixes an issue)

- Use a relative PARALLEL_THRESHOLD in edge_edge_distance_type to
  correctly
  classify nearly-collinear coplanar edges, preventing zero-distance
  errors
- Add defensive guards in NormalPotential gradient/hessian for mollified
  collisions at d=0 to avoid assertion failures
- Add regression test for coplanar near-collinear non-overlapping edges
- Minor test cleanups for clarity and consistency
- Add CLAUDE.md to .gitignore
Copy link
Copy Markdown
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

This PR fixes a numerical classification edge case in edge–edge distance type selection (nearly collinear coplanar edges) and adds a regression test to prevent reintroducing the issue, along with a small defensive change in the normal potential implementation.

Changes:

  • Adjust edge–edge “parallelism” tolerance to be relative (scaled by a*c) to correctly route nearly parallel cases to the parallel handler.
  • Add a regression test covering coplanar near-collinear non-overlapping edges.
  • Add defensive early-returns in NormalPotential for mollified collisions at d <= 0, plus minor test cleanup and .gitignore update.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ipc/distance/distance_type.cpp Updates edge–edge parallelism threshold logic to use a relative tolerance.
src/ipc/potentials/normal_potential.cpp Adds guards in gradient/hessian for mollified collisions when d <= 0.
tests/src/tests/distance/test_distance_type.cpp Adds regression test for the nearly-collinear coplanar edge-edge distance type bug.
tests/src/tests/distance/test_edge_edge.cpp Minor test formatting cleanup (if (s == 0) block braces).
.gitignore Ignores CLAUDE.md.

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

Comment thread src/ipc/potentials/normal_potential.cpp Outdated
Comment thread src/ipc/potentials/normal_potential.cpp Outdated
Comment thread tests/src/tests/distance/test_distance_type.cpp Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.85%. Comparing base (4d9e47e) to head (09844ea).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #225   +/-   ##
=======================================
  Coverage   95.85%   95.85%           
=======================================
  Files         160      160           
  Lines       16655    16661    +6     
  Branches      944      947    +3     
=======================================
+ Hits        15964    15970    +6     
  Misses        691      691           
Flag Coverage Δ
unittests 95.85% <100.00%> (+<0.01%) ⬆️

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.

zfergus added 3 commits April 20, 2026 20:01
- Check m(x) directly instead of d for mollified collisions
- Avoid evaluating barrier derivatives when m <= 0
- Update comments for clarity on product rule and defensive checks
- No change to core logic; improves robustness and maintainability
- Update test comment to match current edge-edge parallelism threshold
  logic
- Apply mollifier hessian only when collision is mollified and m <= 0
- Use correct barrier value and mollifier hessian in this case
- Ensure distance is computed before mollifier for consistency
@zfergus zfergus merged commit 6e60a2d into main Apr 21, 2026
20 of 21 checks passed
@zfergus zfergus deleted the fix/ee-parallel-threshold branch April 21, 2026 14:54
zfergus added a commit that referenced this pull request Apr 24, 2026
* Fix edge-edge parallelism threshold and add regression test

- Use a relative PARALLEL_THRESHOLD in edge_edge_distance_type to
  correctly
  classify nearly-collinear coplanar edges, preventing zero-distance
  errors
- Add defensive guards in NormalPotential gradient/hessian for mollified
  collisions at d=0 to avoid assertion failures
- Add regression test for coplanar near-collinear non-overlapping edges
- Minor test cleanups for clarity and consistency
- Add CLAUDE.md to .gitignore

* Refactor mollifier guard in NormalPotential gradient and hessian

- Check m(x) directly instead of d for mollified collisions
- Avoid evaluating barrier derivatives when m <= 0
- Update comments for clarity on product rule and defensive checks
- No change to core logic; improves robustness and maintainability
- Update test comment to match current edge-edge parallelism threshold
  logic

* Fix mollifier handling in NormalPotential::hessian

- Apply mollifier hessian only when collision is mollified and m <= 0
- Use correct barrier value and mollifier hessian in this case
- Ensure distance is computed before mollifier for consistency
@zfergus zfergus added this to the v1.6.0 milestone May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants