Repository navigation
Fix zero-area cancellation panic in tetrahedron face projection - #455
Open
snowyukitty wants to merge 1 commit into
Open
snowyukitty wants to merge 1 commit into
snowyukitty wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.0assertion.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:
cargo fmt -- --checkcargo test --features wavefrontcargo test -p parry3d-f64cargo clippy -- -D warningsTests ran with the same
zune-core0.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.