   Dynamic quad tree issue
  Hello. I'm experimenting with creating different spatial partitioning techniques and ive hit a sort of a road block in my understanding of a quadtree/octree structure. (The same concept can apply to a kdtree too, but I'm not there yet)When adding an object to the tree (in my case an AABB, but I don't think its important) I place the object within the root node if it is within the boundaries of the current tree structure. If it is not within the boundaries, I create a new root node 4x the size of the current root node, and make the current root node a child within this larger tree level. I repeat this process until the new object fits.I'm noticing a fundamental limiting factor with this technique, however, and that is the implicit boundary of your spatial addressing system. In my case, I have the full range of (MIN_DOUBLE - MAX_DOUBLE) to freely move in any direction, and yes, this seems to be an order of magnitude more than enough for just about any case.But for the sake of good design, I'm trying to sort out a scenario that involves a new object being placed at a location very close to these double range boundaries. Since the tree doubles in size along each dimension with each expansion, it is extremely likely that the cells of the tree will overflow the range of the double data structure.My first (naive) thought was to enclose the entire double bounds into the quad/octree, but this would give such a massive tree depth the entire program would suffer greatly.My second thought (and one I am still investigating) is to make sure that the first root node created by the tree is always a base 2 multiple of the double boundaries. Consideration might have to be taken to ensure it is offset just enough to grow into the implicit box in a proper way, since a root node centered at (0,0) would mess things up when the last step of the trees growth was needed.Has anyone else put thought into this? Or am I just crazy for thinking on such a macro scale?   
  I usually define the first node to be large enough to contains all the possible objects it will contains (for example the level bounds). Another possible solution is to rebuild the entire three when a situation like that happens, but that can be a lot slower than your solution. I personally prefer other data structures (like bounding volume hierarchies) to manage dynamic objects and use quadtree/octree/kd-tree structures for static geometry. But, that's just my opinion.   