I have implemented a Quadtree for sorting points in a graph. Each time a point falls within a quadrant that already contains a point, the quadrant is subdivided again to allow each point to fall into it's own quadrant. Each node has the following attributes:
Rectangle bounds; //The bounds of the quadrant
int num = 0; //The number of points in or below this node
Point point; //The point stored in this node. If the quadrant is divided, this is set to null.
Quadtree sub[]; //Pointers to the 4 subdivided quadrants.
Say I wanted to go through every node that is stored in this tree, and count the number of points that fall within the bounds of a given rectangle, how would I go about recursively checking every node in the tree (Assuming I already have methods that check if they fall in a certain region)?