Skip to content

Fix collision filter on codimensional broad-phase passes - #303

Merged
zfergus merged 1 commit into
mainfrom
fix/codim-collision-filter
Nov 10, 2026
Merged

zfergus merged 1 commit into
mainfrom
fix/codim-collision-filter

Conversation

@zfergus

@zfergus zfergus commented Nov 10, 2026

Copy link
Copy Markdown
Member

Description

Fixes Candidates::build (static and CCD overloads) applying mesh.can_collide to the wrong vertices in the codimensional broad-phase passes.

  • The vertex–vertex pass and the 3D codim.-edge vs. codim.-vertex pass build the broad phase on a subset of the mesh.
  • That broad phase reports subset-local indices (0, 1, 2, …), but can_collide was called on them as if they were mesh vertex ids.
  • On any mesh with codim. vertices and a can_collide filter, pairs that should be filtered leaked through and allowed pairs were dropped.

Fix

  • Translate subset-local ids to mesh vertex ids before calling the filter. The edge–vertex pass maps its combined vertex list (codim. vertices, then codim. edges' vertices) the same way.
  • Restore broad_phase->can_vertices_collide = mesh.can_collide after each pass, since the temporary filters capture locals.

Impact

  • No API changes.
  • Meshes without codim. vertices or without a filter behave as before.
  • Meshes that use both now get the filtering they asked for.

Type of change

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

How Has This Been Tested?

  • New regression test "Collision filter applies to codimensional vertices by mesh vertex id" ([candidates][codim][filter]): 52 assertions. It fails 12 of them on main and passes with this change.
  • ipc_toolkit_tests "[candidates],[codim] ~[!benchmark]": all pass (3951 assertions in 19 test cases).

Test Configuration:

  • OS and Version: macOS (Darwin 27.2.0)
  • Compiler and Version: AppleClang 21.0, C++17, Debug (test preset)

Checklist

  • My code follows the clang-format style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

- Translate subset-local ids to mesh vertex ids before filtering
- Restore the mesh filter on the broad phase after each pass

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.87%. Comparing base (3dd025f) to head (064a5d1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #303   +/-   ##
=======================================
  Coverage   96.86%   96.87%           
=======================================
  Files         229      229           
  Lines       23047    23075   +28     
  Branches     1619     1619           
=======================================
+ Hits        22325    22353   +28     
  Misses        722      722           
Flag Coverage Δ
unittests 96.87% <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 Harness.
📢 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
zfergus merged commit 0801cbb into main Nov 10, 2026
23 checks passed
@zfergus
zfergus deleted the fix/codim-collision-filter branch November 10, 2026 13:26
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.

1 participant