Advertisement Jump to content
Sign in to follow this  
eq

Moving around in balanced implicit quad trees

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

I'm having trouble in finding a fast way to move around in my quad tree. The quad tree is perfectly balanced, i.e for each node (that isn't a leaf) there are always 4 children. I do not want to store the child indices and parent index in the nodes. All nodes are stored in a level by level order (think of an image pyramid, mipmap chain etc). So for the first levels we get this data: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 or:
Level  Start Index  Node Count
0       0             1
1       1             4
2       5            16
3      21            64
4      85           256


Given an index I need to be able to get the following data: * return level (ex 16 => 02). * return the four child indices (ex 18 => 71, 72, 79, 80) * return the parent index (ex 52 => 12). Is there a fast clean way of doing this? [Edited by - eq on March 2, 2005 3:54:19 AM]

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net 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!