Quadtree implementation in C (2D space partitioning and collision detection)