Esempio n. 1
0
 QuadTree(unsigned int newMaxCapacity, float newX, float newY, float newWidth, float newHeight)
 {
     depth = 1;
     //std::cout << "["<< depth <<"]node created\n";
     maxCapacity = newMaxCapacity;
     tL=NULL;
     tR=NULL;
     bL=NULL;
     bR=NULL;
     bounds.setPosition(newX, newY);
     bounds.resize(newWidth, newHeight);
 }
Esempio n. 2
0
 QuadTree(unsigned int newMaxCapacity, float newX, float newY, float newWidth, float newHeight, unsigned int newDepth)
 {
     depth = newDepth + 1;
     maxCapacity = newMaxCapacity;
     //Max depth reached; make sure this node holds a lot because
     //it won't subdivide any more
     if (depth >= MAX_TREE_DEPTH)
     {
         std::cout << "Max depth reached; setting capacity to MAX_DEPTH_CAPACITY\n";
         maxCapacity = MAX_DEPTH_CAPACITY;
     }
     tL=NULL;
     tR=NULL;
     bL=NULL;
     bR=NULL;
     bounds.setPosition(newX, newY);
     bounds.resize(newWidth, newHeight);
 }