KDTree is a system that divides the space into sections.
this process for speeding up searches as:
1- nearest neighbor searches.
2- n nearest neighbor searches.
3- collision detection.
4- range searches.
for more details about kdtree check this: https://en.wikipedia.org/wiki/K-d_tree