diff --git a/scenes/func.py b/scenes/func.py index bc43a1d1f9a0215e748c1d606a4ee53034eb7d7a..e91a508cb1d0aef607666cd0fa42c000758459eb 100644 --- a/scenes/func.py +++ b/scenes/func.py @@ -83,7 +83,7 @@ def ursina_run(bodies, body_sys = System(bodies) if save_as_json is not None: try: - body_sys.save_to_json(save_as_json, {"dt": dt, "position": position}) + body_sys.save_to_json(save_as_json, {"dt": dt, "position": position, "show_trail": show_trail}) print(f"{save_as_json} 文件生成成功!") except Exception as e: print(f"{save_as_json} 文件生成失败!" + str(e)) diff --git a/scenes/gravity_slingshot.py b/scenes/gravity_slingshot.py index 17b58b3aeb8864faa885ced1d2715c10417182c6..6c4149770ba031b7f6402ce9b40a8ea843fb88f3 100644 --- a/scenes/gravity_slingshot.py +++ b/scenes/gravity_slingshot.py @@ -32,4 +32,4 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(bodies, SECONDS_PER_MONTH, position=(0, AU, -3 * AU)) + ursina_run(bodies, SECONDS_PER_MONTH, position=(0, AU, -3 * AU), show_trail=True) diff --git a/scenes/sun_earth.py b/scenes/sun_earth.py index 982bd670547b69b22fde17fa522d4be7e1620c9d..8b9f346aa14ad71844f5a61e0a07371635783b14 100644 --- a/scenes/sun_earth.py +++ b/scenes/sun_earth.py @@ -15,8 +15,7 @@ if __name__ == '__main__': 太阳、地球 Sirius(size_scale=0.2, init_position=[0, 0, 0]), """ bodies = [ - Sirius(size_scale=2e1,init_position=[0,0,0]), - Sun(size_scale=5e1,init_position=[0,0,0]), # 太阳放大 50 倍 + Sun(size_scale=5e1), # 太阳放大 50 倍 Earth(size_scale=2e3, distance_scale=1), # 地球放大 2000 倍,距离保持不变 ] @@ -26,4 +25,4 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(bodies, SECONDS_PER_WEEK, position=(0, AU, -3 * AU)) + ursina_run(bodies, SECONDS_PER_WEEK, position=(0, AU, -3 * AU), show_trail=True) diff --git a/scenes/sun_earth_jupiter.py b/scenes/sun_earth_jupiter.py index 2b8d2ea39777f9a28c8014af6ab207f7de0df613..54c99e3ae12d32452da5a46c65561cf8410b7dfb 100644 --- a/scenes/sun_earth_jupiter.py +++ b/scenes/sun_earth_jupiter.py @@ -26,4 +26,4 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(bodies, SECONDS_PER_WEEK, position=(0, AU, -3 * AU)) + ursina_run(bodies, SECONDS_PER_WEEK, position=(0, AU, -3 * AU), show_trail=True) diff --git a/scenes/three_body_03.py b/scenes/three_body_03.py index 82f849b807ff94a882c41f917a34a5600e38a944..09715cec9dcf7595f8637f7d0a39014a6a621bd0 100644 --- a/scenes/three_body_03.py +++ b/scenes/three_body_03.py @@ -59,4 +59,4 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(bodies, SECONDS_PER_YEAR, position=(3 * AU, 3 * AU, -20 * AU)) + ursina_run(bodies, SECONDS_PER_YEAR, position=(3 * AU, 3 * AU, -20 * AU), show_trail=True) diff --git a/scenes/tri_bodies_sim_perfect.py b/scenes/tri_bodies_sim_perfect.py index c4e9287262e71a1179d18e7fcdb063f522e853ca..83a5fa1fc4035744861a7dc096b7711cbef49423 100644 --- a/scenes/tri_bodies_sim_perfect.py +++ b/scenes/tri_bodies_sim_perfect.py @@ -53,4 +53,4 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(bodies, SECONDS_PER_YEAR, position=(3 * AU, AU, -4 * AU)) + ursina_run(bodies, SECONDS_PER_YEAR, position=(-2 * AU, AU, -5 * AU), show_trail=True) diff --git a/scenes/two_body_01.py b/scenes/two_body_01.py index 16654b4fb048d47da2b536337be40b689e7e05ac..305fda68c4c9809a7380537977da84bdabb6103b 100644 --- a/scenes/two_body_01.py +++ b/scenes/two_body_01.py @@ -33,4 +33,4 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(bodies, SECONDS_PER_YEAR, position=(0, 2 * AU, -5 * AU)) \ No newline at end of file + ursina_run(bodies, SECONDS_PER_YEAR, position=(0, 2 * AU, -5 * AU), show_trail=True) \ No newline at end of file diff --git a/scenes/ursina_json_sim.py b/scenes/ursina_json_sim.py index 254f3e4c93ea3000068e689dc35f14a610dc7348..72677ae91c1a78aebe1cfd020dc9efdca6ccde79 100644 --- a/scenes/ursina_json_sim.py +++ b/scenes/ursina_json_sim.py @@ -29,9 +29,10 @@ if __name__ == '__main__': dt = params["dt"] if "dt" in params else SECONDS_PER_YEAR position = params["position"] if "position" in params else (0, 0, 0) + show_trail = params["show_trail"] if "show_trail" in params else True # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- json_file = None # 指定 json_file 保存路径,则会将模拟环境天体数据保存到该json文件中 - ursina_run(bodies, dt, position=position, save_as_json=json_file) + ursina_run(bodies, dt, position=position, save_as_json=json_file, show_trail=show_trail)