Jump to content
  • Advertisement
Sign in to follow this  
Balaam

Quick (Easy) QuadTree question

This topic is 4430 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Let's say I have a one layer quadtree Root[child-1, child-2, child-3, child-4] So a square divided into four equals chunks. Now let's say I want to add an item to my quad tree - let's say it's big and exists partially in child-1 and child-2. Is it best to store the object in both children (this is what I'm thinking of doing). And what if the object happens to to hit all 4 children - store in all the children? Would I ever store objects in the root node? (I can imagine it would be worth it, if the object was at least as big as the root node) I'll probably be moving my items around reasonably often. Pretty basic :D Just a little unsure.

Share this post


Link to post
Share on other sites
Advertisement
If you can't subdivise the object into smaller parts, I guess the quadtree should store the object into its root node.

That is, you start with a single square. Then you subdivise it in 4 only if some objects can be completly contained into one children. If it overlapses more than one children node, the subdivision stops there.

Never made a QuadTree algorithm, but this is what I understand from literature.

Have fun

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!