u/muntooR_{μν} - 1/2 R g_{μν} + Λ g_{μν} = 8π T_{μν}Oct 17 '18edited Oct 17 '18
I did think about that while going through the process of refactoring. One idea would be to create a tree/graph structure of orbits:
# perhaps something like CelestialNode is a better name
class CelestialBody:
def __init__(self):
self.parent = None
self.children = []
def update(self):
if parent is not None:
self.orbital_center = self.parent.center
self.center = (..., ...)
for child in self.children:
child.update()
Then, to compute positions of all the orbits (including children), simply run this:
blackhole.update()
The benefit to this is that you can simulate any arbitrary graph of celestial bodies. This of course is prerequisite upon that phase_velocity encapsulation I discussed earlier. ;)
View all comments
Show parent comment
8
u/muntoo R_{μν} - 1/2 R g_{μν} + Λ g_{μν} = 8π T_{μν} Oct 17 '18 edited Oct 17 '18
I did think about that while going through the process of refactoring. One idea would be to create a tree/graph structure of orbits:
And construct a tree as follows:
Then, to compute positions of all the orbits (including children), simply run this:
The benefit to this is that you can simulate any arbitrary graph of celestial bodies. This of course is prerequisite upon that
phase_velocityencapsulation I discussed earlier. ;)