Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / creating a new quadtree every (or almost every) frame?

Author
Message
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 24th Feb 2010 22:28
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)


Login to post a reply

Server time is: 2025-05-24 21:16:11
Your offset time is: 2025-05-24 21:16:11