From 0ba5a3d728c4bdc3a38febaa8e0ed121597b74b1 Mon Sep 17 00:00:00 2001 From: march3 Date: Tue, 21 Mar 2023 22:10:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=AA=E9=98=B3=E7=B3=BB=E4=B8=89=E4=BD=93?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/earth_moon.py | 2 +- scenes/func.py | 4 ++++ scenes/three_body_01.py | 4 ++-- scenes/tri_bodies_sim_perfect.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scenes/earth_moon.py b/scenes/earth_moon.py index aeae959..dbd81d5 100644 --- a/scenes/earth_moon.py +++ b/scenes/earth_moon.py @@ -29,4 +29,4 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(bodies, SECONDS_PER_MONTH, position=(0, 0, 0)) + ursina_run(bodies, SECONDS_PER_MONTH, position=(-300000, 300000, -1000000), show_trail=True) diff --git a/scenes/func.py b/scenes/func.py index 450f951..bc43a1d 100644 --- a/scenes/func.py +++ b/scenes/func.py @@ -9,6 +9,7 @@ import matplotlib.pyplot as plt from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY, SECONDS_PER_HALF_DAY from common.system import System +from simulators.ursina.ursina_config import UrsinaConfig from simulators.ursina.ursina_event import UrsinaEvent @@ -60,6 +61,7 @@ def ursina_run(bodies, light=True, cosmic_bg=None, show_grid=True, + show_trail=False, save_as_json=None): """ @@ -132,6 +134,8 @@ def ursina_run(bodies, import sys 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) diff --git a/scenes/three_body_01.py b/scenes/three_body_01.py index a6fa201..3fbfc1b 100644 --- a/scenes/three_body_01.py +++ b/scenes/three_body_01.py @@ -7,7 +7,7 @@ # python_version :3.8 # ============================================================================== 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 if __name__ == '__main__': @@ -34,4 +34,4 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(bodies, SECONDS_PER_DAY, position=(3 * AU, AU, -4 * AU)) \ No newline at end of file + ursina_run(bodies, SECONDS_PER_YEAR, position=(3 * AU, AU, -4 * AU), show_trail=True) \ No newline at end of file diff --git a/scenes/tri_bodies_sim_perfect.py b/scenes/tri_bodies_sim_perfect.py index 5626bf4..c4e9287 100644 --- a/scenes/tri_bodies_sim_perfect.py +++ b/scenes/tri_bodies_sim_perfect.py @@ -6,7 +6,7 @@ # link :https://gitcode.net/pythoncr/ # 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 scenes.func import mayavi_run, ursina_run -- GitLab