An implementation of loose octree with application in collision detection for particle simulation.
Description
This is a simple, single-threaded implementation of a loose octree which is commonplace in computer graphics. It is used for various purposes, for example, for collision detection in particle simulation, as in this program.
Download
Magnum example page with more description
Code (github) from Magnum repository
Windows binary
WebGL Demo
Thanks Vladimír Vondruš for building the awesome WebGL application. This is part of Magnum graphics engine showcase. Note that this WebGL demo requires WebAssembly-capable browser with WebGL enabled.
By default, there are 2000 spheres simulated at slow speed. A better scenario can be seen by following this link.
Usage
Mouse drag
rotates the cameraShift + mouse drag
pans the cameraMouse wheel
zooms in/outR
resets the camera to its original transformationB
shows/hides tree node bounding boxesSpace
pauses/resumes particle simulation
Additionally, various options can be set via command line:
-s, --spheres N — number of spheres to simulate (default: 50)
-r, --sphere-radius R — sphere radius (default: 0.1)
-v, --sphere-velocity V — sphere velocity (default: 1)
For example:
Octree.exe -s 20 -r 0.1 -v 1.0
Gallery