[C++] Insert leaves at different levels into ON_RTree


With ON_RTree::Insert I manage to insert elements into an RTree, only one level below the root node.

How can I put them into different levels, as children of upper level leaves?

I tried using ON_RTree::InsertRect(ON_RTreeBBox* a_rect, ON__INT_PTR a_id, ON_RTreeNode** a_root, int a_level) but this method is inaccessible for me.

Any hint or example will be greatly appreciated.

I think that ON_RTree is self-balancing, that is, if you add enough items it will start creating more levels. For more details, please consult the code which is conveniently forked by PCL

Ok, I see. They are inherently created via rectangle inclusion into existing nodes.

I was looking for a quadtree-like data structure in ON library, but I think there isn’t…

Many thanks,

No, there is no quad-tree or octree in OpenNurbs. I think that for most purposes an R-Tree is superior to an octree.