Skip to content

Instantly share code, notes, and snippets.

@cpgillem
Last active December 26, 2016 01:56
Show Gist options
  • Select an option

  • Save cpgillem/a03c73fe078447bb35033d71df56b97a to your computer and use it in GitHub Desktop.

Select an option

Save cpgillem/a03c73fe078447bb35033d71df56b97a to your computer and use it in GitHub Desktop.
Illustration of how I would conceptualize an array-backed octree data structure, complete with ASCII art.
/*
0 = 000: x-, y-, z-
1 = 001: x-, y-, z+
2 = 010: x-, y+, z-
3 = 011: x-, y+, z+
4 = 100: x+, y-, z-
5 = 101: x+, y-, z+
6 = 110: x+, y+, z-
7 = 111: x+, y+, z+
ASCII ART ~~~~~~~~~~~~~
FRONT
+---+---+ Y
/ 3 / 7 /| |
/---/---/ | +--X
+---+---+| |
| 2 | 6 ||.+
+---+---+'5|
| 0 | 4 ||.+ <--Positive Z
+---+---+' <--Negative Z
^--Behind: 1
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment