Skip to content

Fix zero-area cancellation panic in tetrahedron face projection - #455

Open
snowyukitty wants to merge 1 commit into
dimforge:masterfrom
snowyukitty:fix/degenerate-tetrahedron-raycast
Open

snowyukitty wants to merge 1 commit into
dimforge:masterfrom
snowyukitty:fix/degenerate-tetrahedron-raycast

Conversation

@snowyukitty

Copy link
Copy Markdown

Fixes #451.

When a query point is far from a tetrahedron face, cross products between point-to-vertex vectors can lose the signed triangle areas to floating-point cancellation. In the reported convex-hull raycast, their sum becomes zero and triggers the denom != 0.0 assertion.

When the area sum is zero, recompute the areas from face edges and point-to-vertex vectors, following the existing triangle projection code. The usual calculation, normalization guard, assertion, and barycentric vertex order are preserved. Restricting the fallback to this case avoids perturbing existing GJK contact results near zero separation.

Regression coverage includes the reported ray that should miss, an intersecting ray as a control, and an analytic projection with expected coordinates and barycentric weights. The projection test checks both nearby and distant query points on each of the four face indices.

Validation:

  • On the unmodified base, the miss and distant-projection regressions fail at the existing assertion; the intersecting-ray control passes.
  • cargo fmt -- --check
  • cargo test --features wavefront
  • cargo test -p parry3d-f64
  • cargo clippy -- -D warnings

Tests ran with the same zune-core 0.5.1 pin used by CI; the lockfile adjustment is not part of this patch. PR #298 also touches this file for QueryOptions signatures, without changing this arithmetic.

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.

[BUG] assertion failed: denom != 0.0 with convex hull raycast

1 participant