]> git.itanic.dy.fi Git - sdl-planets/commitdiff
quadtree: Document subtree indexing
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 8 Jul 2011 08:49:32 +0000 (11:49 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 8 Jul 2011 08:49:32 +0000 (11:49 +0300)
As stupid as it might sound, I forgot how the subtrees are indexed in
spatially. Therefore it might make sense to simply document even the
trivial things in the header file to avoid future confusion.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
quadtree.h

index aef487efa0be242942babbfbb8c554eda95108cb..45478fa73a83cb711ddc7fbed69c68ac5b054803 100644 (file)
@@ -8,6 +8,14 @@
 
 struct quadtree {
        struct vector pos;
+
+       /*
+        * Each node divide the sub-tree in following quadtrants:
+        *
+        *       up left (0)  |  up right (1)
+        *      -----------------------------
+        *      down left (2) | down right (3)
+        */
        struct quadtree *child[4];
        struct quadtree *parent;