GJK vs Raycasting

Started by
19 comments, last by Kwizatz 18 years, 9 months ago
Quote:Original post by ajas95
So what exactly are the calculations in GJK that are so prone to floating point error? I was just about to run off and write my own :) Do you think maybe first transforming everything into a space around the unit cube might maximize fp-precision? or is it a different issue...


In my case, the worst case was related to degenerate tetrahedrons (all 4 points laying on a plane, sometimes with 2 points at the same spot or too close to one another), once I wrote a way around that, the problem was random false positives which I couldnt quite figure out where they came from, but being that the positive exit code is if(P==ZeroVector) {return true;}, my guess would be that the problem was also due to a degenerate simplex.

I was making no use of determinants, which, if you examine the code in FreeSOLID or read the book, play a pretty big role in the algorithm.

I doubt transforming the coordinates the way you say would help much, really what you want to do is look out for is degenerate polytopes, that involves calculating some determinants if you are aiming for an elegant approach.

If you're interested, the core GJK implementation in FreeSOLID is in the "Convex.cpp" file, the specific function is "bool intersect(const Convex& a, const Convex& b, const Transform& a2w, const Transform& b2w,Vector& v)".

This topic is closed to new replies.

Advertisement