barnes-hut tree implementation in 3d