This page looks best with JavaScript enabled

Octree

 ·  ☕ 1 min read · 👀... views

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.

Initialization...

Usage

  • Mouse drag rotates the camera
  • Shift + mouse drag pans the camera
  • Mouse wheel zooms in/out
  • R resets the camera to its original transformation
  • B shows/hides tree node bounding boxes
  • Space 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

A screenshot of the program
A screenshot of the program
A screenshot of the program

Share on

Nghia Truong
WRITTEN BY
Nghia Truong
(Trương Trọng Nghĩa)


What's on this Page