diff --git a/barnes-hut-galaxy-new.py b/barnes-hut-galaxy-new.py index 1bbd5de..b6de01b 100644 --- a/barnes-hut-galaxy-new.py +++ b/barnes-hut-galaxy-new.py @@ -107,6 +107,7 @@ class Node: else: self.create_children() self.center_of_mass = (self.center_of_mass * self.mass + star.pos * star.mass) / (self.mass + star.mass) + self.mass += star.mass self.children[self.get_child_index(star.pos)].insert(star)