提交 8f611211 编写于 作者: 三月三net's avatar 三月三net

太阳系三体模拟器

上级 b1f759e2
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -47,4 +47,8 @@ class Alcyone(FixedStar): ...@@ -47,4 +47,8 @@ class Alcyone(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(Alcyone()) fixed_star = Alcyone()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -47,4 +47,8 @@ class Antares(FixedStar): ...@@ -47,4 +47,8 @@ class Antares(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(Antares()) fixed_star = Antares()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -47,4 +47,8 @@ class Betelgeuse(FixedStar): ...@@ -47,4 +47,8 @@ class Betelgeuse(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(Betelgeuse()) fixed_star = Betelgeuse()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -47,4 +47,8 @@ class CanisMajorisVY(FixedStar): ...@@ -47,4 +47,8 @@ class CanisMajorisVY(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(CanisMajorisVY()) fixed_star = CanisMajorisVY()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -47,4 +47,8 @@ class CarinaeV382(FixedStar): ...@@ -47,4 +47,8 @@ class CarinaeV382(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(CarinaeV382()) fixed_star = CarinaeV382()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -47,4 +47,8 @@ class EtaCarinae(FixedStar): ...@@ -47,4 +47,8 @@ class EtaCarinae(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(EtaCarinae()) fixed_star = EtaCarinae()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -47,4 +47,8 @@ class Procyon(FixedStar): ...@@ -47,4 +47,8 @@ class Procyon(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(Procyon()) fixed_star = Procyon()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
class Rigel(FixedStar): class Rigel(FixedStar):
""" """
TODO: 参宿七(Rigel) 参宿七(Rigel)
质量:为21太阳质量 质量:为21太阳质量
大小:为78.9太阳半径 大小:为78.9太阳半径
颜色:为0xFF, 0xEE, 0xC8 颜色:为0xFF, 0xEE, 0xC8
...@@ -25,10 +25,10 @@ class Rigel(FixedStar): ...@@ -25,10 +25,10 @@ class Rigel(FixedStar):
平均密度: 1.408×10³ kg/m³ 平均密度: 1.408×10³ kg/m³
""" """
def __init__(self, name="猎户座一等星", mass=17 * MO, def __init__(self, name="参宿七星", mass=21 * MO,
init_position=[0, 0, 0], init_position=[0, 0, 0],
init_velocity=[0, 0, 0], init_velocity=[0, 0, 0],
color=(0xFF, 0xEE, 0xC8), color=(0x90, 0x90, 0xFF),
texture="fixed_star.png", size_scale=1.0, distance_scale=1.0, texture="fixed_star.png", size_scale=1.0, distance_scale=1.0,
rotation_speed=0.1, ignore_mass=False): rotation_speed=0.1, ignore_mass=False):
params = { params = {
...@@ -36,7 +36,7 @@ class Rigel(FixedStar): ...@@ -36,7 +36,7 @@ class Rigel(FixedStar):
"mass": mass, "mass": mass,
"init_position": init_position, "init_position": init_position,
"init_velocity": init_velocity, "init_velocity": init_velocity,
"density": 1.408e3, "density": 0.060199,
"color": color, "color": color,
"texture": texture, "texture": texture,
"size_scale": size_scale, "size_scale": size_scale,
...@@ -48,4 +48,8 @@ class Rigel(FixedStar): ...@@ -48,4 +48,8 @@ class Rigel(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(Rigel()) fixed_star = Rigel()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -35,7 +35,7 @@ class Sirius(FixedStar): ...@@ -35,7 +35,7 @@ class Sirius(FixedStar):
"mass": mass, "mass": mass,
"init_position": init_position, "init_position": init_position,
"init_velocity": init_velocity, "init_velocity": init_velocity,
"density": 1.408e3, "density": 2.6e3,
"color": color, "color": color,
"texture": texture, "texture": texture,
"size_scale": size_scale, "size_scale": size_scale,
...@@ -47,4 +47,8 @@ class Sirius(FixedStar): ...@@ -47,4 +47,8 @@ class Sirius(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(Sirius()) fixed_star = Sirius()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
class Stephenson_2_18(FixedStar): class Stephenson_2_18(FixedStar):
""" """
TODO: 史蒂文森2-18 (Stephenson 2-18) 史蒂文森2-18 (Stephenson 2-18)
质量:40.0 太阳质量 质量:40.0 太阳质量
大小:2150 太阳半径 大小:2150 太阳半径
颜色:0xFF, 0xFF, 0xFF 颜色:0xFF, 0xFF, 0xFF
...@@ -28,7 +28,7 @@ class Stephenson_2_18(FixedStar): ...@@ -28,7 +28,7 @@ class Stephenson_2_18(FixedStar):
def __init__(self, name="史蒂文森2-18", mass=40 * MO, def __init__(self, name="史蒂文森2-18", mass=40 * MO,
init_position=[0, 0, 0], init_position=[0, 0, 0],
init_velocity=[0, 0, 0], init_velocity=[0, 0, 0],
color=((0xFF, 98, 25)), color=((0xFF, 60, 0)),
texture="fixed_star.png", size_scale=1.0, distance_scale=1.0, texture="fixed_star.png", size_scale=1.0, distance_scale=1.0,
rotation_speed=0.1, ignore_mass=False): rotation_speed=0.1, ignore_mass=False):
params = { params = {
...@@ -48,4 +48,8 @@ class Stephenson_2_18(FixedStar): ...@@ -48,4 +48,8 @@ class Stephenson_2_18(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(Stephenson_2_18()) fixed_star = Stephenson_2_18()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# link :https://gitcode.net/pythoncr/ # link :https://gitcode.net/pythoncr/
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import FixedStar from bodies import FixedStar, Sun
from common.consts import MO from common.consts import MO
...@@ -47,4 +47,8 @@ class WR21a(FixedStar): ...@@ -47,4 +47,8 @@ class WR21a(FixedStar):
if __name__ == '__main__': if __name__ == '__main__':
print(WR21a()) fixed_star = WR21a()
sun = Sun()
print(fixed_star)
print("质量倍数", fixed_star.mass / sun.mass)
print("半径倍数", fixed_star.raduis / sun.raduis)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册