Implemented BspTree class.