-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix redundant pair checking of SpatialHashingCollisionManager #156
Merged
Conversation
This file contains 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
…e vectorizable Eigen objects
Replace NULL with nullptr
Enable Win32 build on Appveyor
Enable SSE2 by default
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.
This PR fixes redundant pair checking of
SpatialHashingCollisionManager
.SpatialHashingCollisionManager
accelerates broadphase collision checking using a hash table for the objects in a special region called scene limit, which is defined by an AABB. Using thescene limit
the manager distinguishes objects into three groups depending on their positions as:The manager stores objects in G1 and G2 using the hash table and stores G2 and G3 in
std::list
. The manager then performs the broadphase check for an object against the objects in the manager depending on where the object is.In Case1, the object is checked against G1 and G2 using the hash table. In Case3, the object is checked against G2 and G3 using the
std::list
. Finally, in Case2, the object is checked against G1, G2, and G3 using both of the hash table and thestd::list
since it is possible to be in collision with any object in the manager. However, the problem is the object is checked against G2 twice (one by the hash table and one by thestd::list
), which is redundant.To address the problem, this PR changes the manager to hold objects of G2 and G3 into two lists, List1 and List2. In Case2, the object is checked against G1 and G2 using the hash table and against G3 using List2, and in Case3, the object is checked against G2 and G3 using the two lists.
Also, new test is added to make sure all the broadphase managers don't redundant pair checking.