Add basic k-d tree

Lines and circles are now sorted into a tree structure. Currently there is
no determination of which type the child nodes should be, but primitives
are correctly sorted only into the necessary areas.