Skip to content
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
merged 18 commits into from
Aug 14, 2016

Conversation

jslee02
Copy link
Member

@jslee02 jslee02 commented Aug 13, 2016

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 the scene limit the manager distinguishes objects into three groups depending on their positions as:

  • G1: objects inside of the scene limit
  • G2: objects partially penetrating into the scene limit
  • G3: objects outside of the scene limit.

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.

  • Case1: the object is in G1 (inside of the limit)
  • Case2: the object is in G2 (neither of inside nor outside)
  • Case3: the object is in G3 (outside of the limit)

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 the std::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 the std::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.

@jslee02 jslee02 added this to the FCL 0.6.0 milestone Aug 13, 2016
@jslee02 jslee02 merged commit bc091ee into templatize Aug 14, 2016
@jslee02 jslee02 deleted the fix_spatial_hashing branch August 15, 2016 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant