Add an analytic ray-capsule intersection test - #446
Open
joonazan wants to merge 6 commits into
Open
Conversation
Author
|
Replaced the initial AI version of the collision check with a handwritten one that is shorter and is much more numerically stable due to cross products instead of dot products followed by |
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.
I need ray-capsule intersections and was surprised that they were really slow because they are implemented via GJK, so I wrote an analytical version.
I did not solve the equations myself. I adapted Inigo Quilez's GLSL. The result is more optimized than anything else I can find.
On my machine the analytical version takes about 5 ns per query hit or miss. GJK takes 50 ns on a miss and 400 - 700 ns on a hit.
The analytical version's error is smaller, too. Could be better, though. In extreme corner cases errors of 1e-3 can be observed at scales of a few units using f32.