提交 0ba5a3d7 编写于 作者: 三月三net's avatar 三月三net

太阳系三体模拟器

上级 21ae8251
...@@ -29,4 +29,4 @@ if __name__ == '__main__': ...@@ -29,4 +29,4 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果 # 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后- # position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_MONTH, position=(0, 0, 0)) ursina_run(bodies, SECONDS_PER_MONTH, position=(-300000, 300000, -1000000), show_trail=True)
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY, SECONDS_PER_HALF_DAY from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY, SECONDS_PER_HALF_DAY
from common.system import System from common.system import System
from simulators.ursina.ursina_config import UrsinaConfig
from simulators.ursina.ursina_event import UrsinaEvent from simulators.ursina.ursina_event import UrsinaEvent
...@@ -60,6 +61,7 @@ def ursina_run(bodies, ...@@ -60,6 +61,7 @@ def ursina_run(bodies,
light=True, light=True,
cosmic_bg=None, cosmic_bg=None,
show_grid=True, show_grid=True,
show_trail=False,
save_as_json=None): save_as_json=None):
""" """
...@@ -132,6 +134,8 @@ def ursina_run(bodies, ...@@ -132,6 +134,8 @@ def ursina_run(bodies,
import sys import sys
sys.modules["__main__"].update = callback_update sys.modules["__main__"].update = callback_update
if show_trail:
UrsinaConfig.show_trail = show_trail
simulator.run(dt, light=light, cosmic_bg=cosmic_bg, show_grid=show_grid) simulator.run(dt, light=light, cosmic_bg=cosmic_bg, show_grid=show_grid)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# python_version :3.8 # python_version :3.8
# ============================================================================== # ==============================================================================
from bodies import Sun, Earth from bodies import Sun, Earth
from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY, AU from common.consts import SECONDS_PER_WEEK, SECONDS_PER_YEAR, SECONDS_PER_MONTH, AU
from scenes.func import mayavi_run, ursina_run from scenes.func import mayavi_run, ursina_run
if __name__ == '__main__': if __name__ == '__main__':
...@@ -34,4 +34,4 @@ if __name__ == '__main__': ...@@ -34,4 +34,4 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果 # 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后- # position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_DAY, position=(3 * AU, AU, -4 * AU)) ursina_run(bodies, SECONDS_PER_YEAR, position=(3 * AU, AU, -4 * AU), show_trail=True)
\ No newline at end of file \ 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 Sun, Earth from bodies import Sun, Earth, FixedStar
from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY, AU, SECONDS_PER_MONTH, SECONDS_PER_YEAR from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY, AU, SECONDS_PER_MONTH, SECONDS_PER_YEAR
from scenes.func import mayavi_run, ursina_run from scenes.func import mayavi_run, ursina_run
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册