Quadtree Lecture 2/3: Writing a Quadtree & Insertion

Channel:
Subscribers:
2,650
Published on ● Video Link: https://www.youtube.com/watch?v=LpmfeeMFz3M



Duration: 1:24:17
429 views
6


In Part 1 we wrote and tested the helper functions. This time we wrote an insert function that would take a Rectangle and would insert it into the Quadtree, clipping (splitting) it into up to 4 smaller-rectangles if necessary.

When a node of a Quadtree exceeds holding "threshold" number of Rectangles, we split the Quadtree node into four and recursively re-insert all of the Rectangles into the child nodes.