Probably due to being in exactly the middle between all children.
Proposed workaround:
If adding an observation of the agent itself, add a small (smaller than smallest box size) number to x and y in random directions to make sure it will fit in a child cell.
Log of an occurence:
[t=1035] Adding occupied area between 0, 0 and 0.390625, 0.390625 so at 0, 0
[t=1035] Adding coordinate to quadtree: 0 0 2
[t=1035] Adding quadnode to quadtree: 0 0 2
[t=1035] Adding value to quadtree: 0 0 2
[t=1035] Adding value to quadtree: -2.5 2.5 2
[t=1035] Adding value to quadtree: -2.5 2.5 2
[t=1035] Adding value to quadtree: -3.75 3.75 2
[t=1035] Adding value to quadtree: -3.75 3.75 2
[t=1035] Adding value to quadtree: -3.75 3.75 2
[t=1035] Adding value to quadtree: -4.375 4.375 2
[t=1035] Adding value to quadtree: -4.375 4.375 2
[t=1035] Adding value to quadtree: -4.375 4.375 2
[t=1035] Adding value to quadtree: -4.6875 4.6875 2
[t=1035] Adding value to quadtree: -4.6875 4.6875 2
[t=1035] Adding value to quadtree: -4.6875 4.6875 2
[t=1035] Adding value to quadtree: -4.84375 4.84375 2
[t=1035] Adding value to quadtree: -4.84375 4.84375 2
[t=1035] Adding value to quadtree: -4.84375 4.84375 2
[t=1035] Adding value to quadtree: -4.92188 4.92188 2
[t=1035] In box -4.84375 4.84375 with size 0.3125
[t=1035] Adding value to child 0
[t=1035] So adding to subbox with center -4.92188 4.92188 with size 0.15625
[t=1035] Adding value to quadtree: -4.92188 4.92188 2
[t=1035] Adding value to quadtree: -4.76562 4.92188 2
[t=1035] In box -4.84375 4.84375 with size 0.3125
[t=1035] Adding value to child 1
[t=1035] So adding to subbox with center -4.76562 4.92188 with size 0.15625
[t=1035] Adding value to quadtree: -4.76562 4.92188 2
[t=1035] Adding value to quadtree: -4.92188 4.76562 2
[t=1035] In box -4.84375 4.84375 with size 0.3125
[t=1035] Adding value to child 2
[t=1035] So adding to subbox with center -4.92188 4.76562 with size 0.15625
[t=1035] Adding value to quadtree: -4.92188 4.76562 2
[t=1035] Adding value to quadtree: -4.76562 4.76562 2
[t=1035] In box -4.84375 4.84375 with size 0.3125
[t=1035] Adding value to child 3
[t=1035] So adding to subbox with center -4.76562 4.76562 with size 0.15625
[t=1035] Adding value to quadtree: -4.76562 4.76562 2
[t=1035] In box -4.84375 4.84375 with size 0.3125
Probably due to being in exactly the middle between all children.
Proposed workaround: If adding an observation of the agent itself, add a small (smaller than smallest box size) number to x and y in random directions to make sure it will fit in a child cell.
Log of an occurence:
[t=1035] Adding occupied area between 0, 0 and 0.390625, 0.390625 so at 0, 0 [t=1035] Adding coordinate to quadtree: 0 0 2 [t=1035] Adding quadnode to quadtree: 0 0 2 [t=1035] Adding value to quadtree: 0 0 2 [t=1035] Adding value to quadtree: -2.5 2.5 2 [t=1035] Adding value to quadtree: -2.5 2.5 2 [t=1035] Adding value to quadtree: -3.75 3.75 2 [t=1035] Adding value to quadtree: -3.75 3.75 2 [t=1035] Adding value to quadtree: -3.75 3.75 2 [t=1035] Adding value to quadtree: -4.375 4.375 2 [t=1035] Adding value to quadtree: -4.375 4.375 2 [t=1035] Adding value to quadtree: -4.375 4.375 2 [t=1035] Adding value to quadtree: -4.6875 4.6875 2 [t=1035] Adding value to quadtree: -4.6875 4.6875 2 [t=1035] Adding value to quadtree: -4.6875 4.6875 2 [t=1035] Adding value to quadtree: -4.84375 4.84375 2 [t=1035] Adding value to quadtree: -4.84375 4.84375 2 [t=1035] Adding value to quadtree: -4.84375 4.84375 2 [t=1035] Adding value to quadtree: -4.92188 4.92188 2 [t=1035] In box -4.84375 4.84375 with size 0.3125 [t=1035] Adding value to child 0 [t=1035] So adding to subbox with center -4.92188 4.92188 with size 0.15625 [t=1035] Adding value to quadtree: -4.92188 4.92188 2 [t=1035] Adding value to quadtree: -4.76562 4.92188 2 [t=1035] In box -4.84375 4.84375 with size 0.3125 [t=1035] Adding value to child 1 [t=1035] So adding to subbox with center -4.76562 4.92188 with size 0.15625 [t=1035] Adding value to quadtree: -4.76562 4.92188 2 [t=1035] Adding value to quadtree: -4.92188 4.76562 2 [t=1035] In box -4.84375 4.84375 with size 0.3125 [t=1035] Adding value to child 2 [t=1035] So adding to subbox with center -4.92188 4.76562 with size 0.15625 [t=1035] Adding value to quadtree: -4.92188 4.76562 2 [t=1035] Adding value to quadtree: -4.76562 4.76562 2 [t=1035] In box -4.84375 4.84375 with size 0.3125 [t=1035] Adding value to child 3 [t=1035] So adding to subbox with center -4.76562 4.76562 with size 0.15625 [t=1035] Adding value to quadtree: -4.76562 4.76562 2 [t=1035] In box -4.84375 4.84375 with size 0.3125