sezna / bigbang

Efficiently calculate gravitational acceleration.
38 stars 1 forks source link

Simulation doesn't work with only two entities #29

Closed sezna closed 4 years ago

sezna commented 4 years ago

The root (heh) cause of this is the tree structure. If there is only one node in the tree, the recursion on children never happens. This means that the gravity of the root node was never being calculated in the first place. I'm solving this by adding a phantom parent node which is actually just an empty node that points to the real root of the tree, thus allowing the correct behavior to emerge without editing any of the recursion logic.