Whenever I store data in a quadtree, I provide its BB and an algorithm finds the correct nodes in the quadtree containing the provided BB.
My problem is the special case where the BB I provide shares boundaries with quadtree boxes. In this case more than 1 quadtree box with fit the search criterion (containment) and my data will be consequently written into more than 1 node.
A BB stretches from (-0.5, -0.5) to (0.5, 0.5), but there are quadtree boxes to the left and right, up and down of this BB, as well as diagonally, and these will duplicate the data I provide, as they all share 1 boundary with this box. Even worse, the quadtree boxes laying diagonally from this box share exactly 1 pixel (the corner) with it, hence they are taken in too, for a whooping total of 9 boxes having the provided data written into. A picture:
You can see 9 quadtree boxes (B) and the provided one (X) fitting a quadtree box completely.
How do you solve this problem of shared boundaries?