Advertisement Jump to content
Sign in to follow this  

How To Search A Quadnode Fast?

This topic is 907 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

If the maximum level of division is 6, and I start off at the root,

If I search if the point intersects with the current quadnode's bounding box,

the worst case is 24 iterations, am I correct?

If I sort the bounding boxes in advance, and use a binary search,

the maximum speed is 12 iterations, right?


In the octree case, the worst case is doubled, to 48 iterations,

with binary search of 24 iterations in the worst case?


Is it possible to use a position, just any positions, as a hash key....

I think it's only possible if the array is fixed size, I don't know how to do it if the octree is sparse



Edited by lucky6969b

Share this post

Link to post
Share on other sites
If you get the integer position of the node in tree-space, subsequent bits (1 for each axis, 2 total for quadtree) will index into the correct child node (as if it was 2x2 array).

So on nth level, read nth bit of position on each axis (first bit is most significant bit - make sure the zero pos is in middle of integer range like with signed ints)

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!