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 adds a new space based on a dynamic AABB tree.
![bvh_full_rebuild](https://user-images.githubusercontent.com/9357697/33902174-7b9b5b50-df74-11e7-94c4-59174bad7217.png)
Even though the existing DxSAPSpace2 works quite well for small and medium-sized worlds (up to roughly 1500-2000 geoms), it does not scale well when the worlds grow beyond that. The attached graphs were created based on the output of SpacePerformanceTest and clearly show the issue.
On the other hand, BVH space seems to address the scalability issue much better.
I tried to keep the implementation as simple as possible. I have found a neat dynamic stackless AABB tree implementation in Turbulenz Engine (https://github.com/turbulenz/turbulenz_engine/blob/master/tslib/aabbtree.ts) which is licensed under the MIT license and I ported it to Java.
The implementation tends to rebuild the tree quite often, but the rebuild process is relatively fast and the data structures quite efficient. There are also a few minor improvements introduced by me compared to the original implementation in Typescript.