If I want to traverse a quadtree, do the dimensions have to be only 2^n ?
If not, what if it cannot be divided into equal subquadrants? for example, 5×6 table with data.
If I want to traverse a quadtree, do the dimensions have to be only
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are several ways to approach this problem.
First of all, your subdivisions are entirely arbitrary. You can set up the first subdivision to interpret your table 5×6 table dimensions as [1 + 4] x [2 + 4]. Then your four quadrants would be 1×2, 1×4, 4×2 and 4×4. At this point you can recurse as dimensions are 2^n.
To make this transparent to your code, you can define functions to map between quad tree coordinates and table indices.