I am in need of creating a quadtree each frame. I think that creating a quadtree each frame would be a lot less than optimal.
My idea is to only build the entire quadtree once. After each subsequent frame, every time an object moves out of it's section, a piece of the quadtree would be updated. Much better (I would think) than just creating a new one all the time.
Now... I'm new to c++... I've never created a quadtree before, so I might mess something up, and make my application slower than if I had just settled. My question is this: are there any tricks to doing this? I'm sure what I'm doing has been done a hundred times before, so if there's bound to be some optimization that I didn't think of.
The quadtree will be used for a barnes-hut algorithm (calculating gravity on n bodies) and collision, so it is necessary to be updated each frame (or each time a body moves out of it's quad)