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

太阳系三体模拟器

上级 895730b7
# -*- coding:utf-8 -*-
# title :地球晚上模拟运行
# description :地球晚上模拟运行
# author :Python超人
# date :2023-02-11
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from bodies import Earth
from common.consts import SECONDS_PER_HOUR
from scenes.func import ursina_run
if __name__ == '__main__':
"""
高清水星模拟运行
"""
bodies = [
Earth(texture="earth_at_night.jpg",
init_position=[0, 0, 0], init_velocity=[0, 0, 0],
size_scale=100.0001, ignore_mass=True)
]
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_HOUR / 2, position=(0, 200000, -2000000), cosmic_bg="../textures/cosmic2.jpg")
# -*- coding:utf-8 -*-
# title :高清水星模拟运行
# description :高清水星模拟运行
# author :Python超人
# date :2023-02-11
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from bodies import Mercury
from common.consts import SECONDS_PER_WEEK, SECONDS_PER_DAY
from scenes.func import ursina_run
if __name__ == '__main__':
"""
高清水星模拟运行
"""
bodies = [
Mercury(texture="mercury_hd.tif",
init_position=[0, 0, 0], init_velocity=[0, 0, 0],
size_scale=100)
]
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_DAY, position=(0, 30000, -600000), cosmic_bg="../textures/cosmic1.jpg")
......@@ -42,4 +42,4 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_YEAR, position=(0, 2 * AU, -11 * AU))
ursina_run(bodies, SECONDS_PER_YEAR, position=(0, 2 * AU, -11 * AU), bg_music="../sounds/universe_04.mp3")
......@@ -27,4 +27,4 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run(bodies, SECONDS_PER_WEEK, position=(0, AU / 2, -3 * AU))
ursina_run(bodies, SECONDS_PER_WEEK, position=(0, AU / 4, -2 * AU), bg_music="../sounds/universe_02.mp3")
......@@ -22,11 +22,11 @@ if __name__ == '__main__':
mass = 2e30
r = 2 * AU
# p = 12 # 三体转圆形花
p = 14.88 # 三体转圈近似圆形
# p = 16 # 三体转圆形花
# p = 18 # 三体转圆形花
# p = 19 # 三体转圆形花
# p = 12 # TODO: 三体转圆形花
p = 14.88 # TODO: 三体转圈近似圆形
# p = 16 # TODO: 三体转圆形花
# p = 18 # TODO: 三体转圆形花
# p = 19 # TODO: 三体转圆形花
bodies = [
Sun(name="红轨太阳A", mass=mass,
init_position=[0, math.sqrt(3) * r, 0],
......
......@@ -19,11 +19,11 @@ if __name__ == '__main__':
# TODO: 去掉注释,在地球上看月相演示变化过程演示
# bodies, params = Body.build_bodies_from_json('../data/sun_earth_moon.json')
# TODO: 去掉注释,完美数据的三体模型的演示01(等边三角形)
# bodies, params = Body.build_bodies_from_json('../data/tri_bodies_sim_perfect_01.json')
bodies, params = Body.build_bodies_from_json('../data/tri_bodies_sim_perfect_01.json')
# TODO: 去掉注释,完美数据的三体模型的演示02(等边三角形)
# bodies, params = Body.build_bodies_from_json('../data/tri_bodies_sim_perfect_02.json')
# TODO: 去掉注释,完美数据的三体模型的演示03(等边三角形)
bodies, params = Body.build_bodies_from_json('../data/tri_bodies_sim_perfect_03.json')
# bodies, params = Body.build_bodies_from_json('../data/tri_bodies_sim_perfect_03.json')
# TODO: 去掉注释,引力弹弓的演示
# bodies, params = Body.build_bodies_from_json('../data/gravity_slingshot.json')
......
......@@ -290,7 +290,8 @@ class UrsinaSimulator(Simulator):
bg_music = None
if bg_music is None:
bg_music = "../sounds/universe_04.mp3"
# bg_music = "../sounds/universe_04.mp3"
bg_music = "../none"
if os.path.exists(bg_music):
audio = Audio(bg_music, pitch=1, loop=True, autoplay=True)
......
textures/pluto.jpg

6.6 MB | W: | H:

textures/pluto.jpg

336.8 KB | W: | H:

textures/pluto.jpg
textures/pluto.jpg
textures/pluto.jpg
textures/pluto.jpg
  • 2-up
  • Swipe
  • Onion skin
因为 它太大了无法显示 image diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册