Make quadtrees generic

Rewrite quadtrees to store generic types rather than store points.
r? @pcwalton