From 70a6259d8b3f14bcfdfb6f26c3b8a770d02c0ab3 Mon Sep 17 00:00:00 2001 From: Crizomb <62544756+Crizomb@users.noreply.github.com> Date: Wed, 15 Feb 2023 13:34:49 +0100 Subject: [PATCH] bug fix --- barnes-hut-galaxy-new.py | 1 + 1 file changed, 1 insertion(+) 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)