Loose octree for accelerating collision detection.
Simple, single-threaded implementation of a loose octree which is commonplace in computer graphics. In this example, octree is used for collision detection.
- mouse drag rotates the camera
- Shift mouse drag pans the camera
- mouse wheel zooms in/out
- R resets the camera to its original transformation
- O switches between a brute force and octree collision detection
- B shows/hides tree node bounding boxes
- P toggles frame profiling to the console using DebugTools::
- Space pauses/resumes particle simulation
Additionally, various options can be set via command line:
--spheres N— number of spheres to simulate (default: 2000)
--sphere-radius R— sphere radius (default: 0.0333)
--sphere-velocity V— sphere velocity (default: 0.05)
With the default setting, the octree collision detection is about twice as fast than the brute force method. In order to better see the octree visualization, run the example for example with the following parameters:
./magnum-octree -s 20 -r 0.1 -v 1.0
This example was originally contributed by Nghia Truong.