bepu / bepuphysics2

Pure C# 3D real time physics simulation library, now with a higher version number.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider incremental tree refines on insertion

RossNordby opened this issue · comments

By default, greedy leaf insertion easily falls into pathological cases. Consider inserting a series of boxes with uniformly increasing position: each split that gets created cannot be undone, resulting in something more like a linked list.

Gathering subtrees along the path to an insertion and running a refinement on it does work to avoid that, but the binned refinement is too slow to be practical for simulations that need to insert millions of elements.

It's not surprising that a full binned build is too expensive. A lot of other cheaper options exist. It may be worth trying local rotations; they're small, but so is the effect of a single insertion.

Value of this is relatively low—most people aren't creating a perfectly ordered simulation of 50,000+ objects, and incremental refinement can bring the tree to high quality rapidly—but it may be worth a little bit of experimentation.

Well that was easy. Default add now performs rotations top-down along the insertion path. Faster than bottom-up by a little, but a little worse quality. Prevents pathological trees.