“578f06745c466130c411fb9653f77587f3bb5351”上不存在“bodies/fixed_stars/git@gitcode.net:pythoncr/universe_sim.git”
提交 0135ce75 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 bd901895
...@@ -49,7 +49,7 @@ class HalleComet(RockSnow): ...@@ -49,7 +49,7 @@ class HalleComet(RockSnow):
} }
super().__init__(**params) super().__init__(**params)
# create_cone(radius, height, subdivisions, r=0.1) # create_cone(radius, height, subdivisions, r=0.1)
self.comet_info = (0.18, 1.5, 100, 0.2) self.comet_info = (0.18, 2.0, 100, 0.2)
from ursina.prefabs.primitives import Shader from ursina.prefabs.primitives import Shader
......
此差异已折叠。
...@@ -211,7 +211,7 @@ def calc_simulator(params): ...@@ -211,7 +211,7 @@ def calc_simulator(params):
2023年12月9日 - 1986年2月9日 = 13817 2023年12月9日 - 1986年2月9日 = 13817
35.1AU 0.586AU 35.1AU 0.586AU
""" """
if abs(comet_peri - 0.586) < 0.01 and abs(comet_aphel - 35.1) < 0.1 and abs(diff_days - 13817) < 2: if abs(comet_peri - 0.586) < 0.01 and abs(comet_aphel - 35.1) < 0.1: # and abs(diff_days - 13817) < 2:
print("OK ......", comet_peri, comet_aphel, diff_days) print("OK ......", comet_peri, comet_aphel, diff_days)
# print("year days:", time_data.years, time_data.days) # print("year days:", time_data.years, time_data.days)
# print("远日点: %.3f AU(%s)" % (sim.comet_aphel / AU, sim.comet_aphel_dt)) # print("远日点: %.3f AU(%s)" % (sim.comet_aphel / AU, sim.comet_aphel_dt))
...@@ -272,8 +272,7 @@ if __name__ == '__main__': ...@@ -272,8 +272,7 @@ if __name__ == '__main__':
# target_function(-2.835, 4.72, 8.847) # 远日点:35.144 AU, 近日点:0.586 AU, 天数: 13748 # target_function(-2.835, 4.72, 8.847) # 远日点:35.144 AU, 近日点:0.586 AU, 天数: 13748
# target_function(-2.835, 4.71, 8.86) # 远日点:35.243 AU, 近日点:0.584 AU, 天数: 13809 # target_function(-2.835, 4.71, 8.86) # 远日点:35.243 AU, 近日点:0.584 AU, 天数: 13809
# target_function(-2.835, 4.73, 8.85) # OK 远日点:35.251 AU, 近日点:0.585 AU, 天数: 13815 # target_function(-2.835, 4.73, 8.85) # OK 远日点:35.251 AU, 近日点:0.585 AU, 天数: 13815
a, b, c = target_function(-2.47, 5.13, 8.73) # a, b, c = target_function(-2.47, 5.13, 8.73)
# [-2.5, 5.02, 8.763] 远日点:35.032 AU, 近日点:0.477 AU, 天数: 13615 # [-2.5, 5.02, 8.763] 远日点:35.032 AU, 近日点:0.477 AU, 天数: 13615
# [-2.835, 4.81, 8.8] 远日点:35.161 AU, 近日点:0.591 AU, 天数: 13754 # [-2.835, 4.81, 8.8] 远日点:35.161 AU, 近日点:0.591 AU, 天数: 13754
...@@ -292,11 +291,18 @@ if __name__ == '__main__': ...@@ -292,11 +291,18 @@ if __name__ == '__main__':
# 远日点: 35.086 AU((40, 346, 14946.8522)) # 远日点: 35.086 AU((40, 346, 14946.8522))
# 近日点: 0.586 AU((3, 133, 1228.3418)) # 近日点: 0.586 AU((3, 133, 1228.3418))
# 远\近日天数: 13718 天 # 远\近日天数: 13718 天
R = 2
# for x in range(-2,2): # X, Y, Z = -2.835, 4.73, 8.85
# for y in range(-2, 2): X, Y, Z = -2.835, 4.72, 8.847
# for z in range(-2, 2): X, Y, Z = -2.826, 4.695, 8.86
idx = 0
for x in range(-R, R + 1):
for y in range(-R, R + 1):
for z in range(-R, R + 1):
x, y, z = X + (x / 100), Y + (y / 100), Z + (z / 100)
idx += 1
print(f"Index:{idx} ---------------------------")
a, b, c = target_function(x, y, z)
# def t(): # def t():
# global idx # global idx
# params = HalleyCometParams( # params = HalleyCometParams(
......
...@@ -34,7 +34,7 @@ def create_halley_comet(init_velocity, init_position): ...@@ -34,7 +34,7 @@ def create_halley_comet(init_velocity, init_position):
# 每76.1年环绕太阳一周的周期彗星 # 每76.1年环绕太阳一周的周期彗星
halley_comet = HalleComet( halley_comet = HalleComet(
# size_scale=4e7, # size_scale=4e7,
size_scale=1e8, size_scale=0.2e8,
init_velocity=init_velocity, init_velocity=init_velocity,
init_position=init_position) \ init_position=init_position) \
.set_light_disable(True) .set_light_disable(True)
...@@ -73,10 +73,10 @@ class HalleyCometSimBase: ...@@ -73,10 +73,10 @@ class HalleyCometSimBase:
self.venus = Venus(size_scale=3e3, show_trail=show_trail) self.venus = Venus(size_scale=3e3, show_trail=show_trail)
self.earth = Earth(size_scale=3e3, rotate_angle=0, show_trail=show_trail) self.earth = Earth(size_scale=3e3, rotate_angle=0, show_trail=show_trail)
self.mars = Mars(size_scale=4e3, show_trail=show_trail) self.mars = Mars(size_scale=4e3, show_trail=show_trail)
self.jupiter = Jupiter(size_scale=2.5e3, show_trail=show_trail) self.jupiter = Jupiter(size_scale=0.8e3, show_trail=show_trail)
self.saturn = Saturn(size_scale=2.5e3, show_trail=show_trail) self.saturn = Saturn(size_scale=0.8e3, show_trail=show_trail)
self.uranus = Uranus(size_scale=6e3, show_trail=show_trail) self.uranus = Uranus(size_scale=3e3, show_trail=show_trail)
self.neptune = Neptune(size_scale=6e3, show_trail=show_trail) self.neptune = Neptune(size_scale=3e3, show_trail=show_trail)
self.pluto = Pluto(size_scale=1e5, show_trail=show_trail) self.pluto = Pluto(size_scale=1e5, show_trail=show_trail)
self.bodies = [ self.bodies = [
self.sun, # 太阳 self.sun, # 太阳
......
...@@ -66,7 +66,8 @@ class HalleyCometSim(HalleyCometSimBase): ...@@ -66,7 +66,8 @@ class HalleyCometSim(HalleyCometSimBase):
# UrsinaConfig.trail_type = "line" # UrsinaConfig.trail_type = "line"
# UrsinaConfig.trail_thickness_factor = 3 # UrsinaConfig.trail_thickness_factor = 3
# UrsinaConfig.trail_length = 91 # UrsinaConfig.trail_length = 91
UrsinaConfig.trail_length = 225 UrsinaConfig.trail_length = 180
UrsinaConfig.trail_factor = 3
# camera.clip_plane_near = 0.1 # camera.clip_plane_near = 0.1
camera.clip_plane_far = 1000000 camera.clip_plane_far = 1000000
create_sphere_sky(scale=200000) create_sphere_sky(scale=200000)
...@@ -227,7 +228,8 @@ if __name__ == '__main__': ...@@ -227,7 +228,8 @@ if __name__ == '__main__':
# 2019年5月6日 34.772 # 2019年5月6日 34.772
params = HalleyCometParams( params = HalleyCometParams(
start_time='1982-09-24 00:00:00', start_time='1982-09-24 00:00:00',
init_velocity=[-2.835, 4.72, 8.847], # init_velocity=[-2.835, 4.72, 8.847],
init_velocity=[-2.826, 4.695, 8.86],
# init_velocity=[-2.836, 4.705, 8.85], # init_velocity=[-2.836, 4.705, 8.85],
init_position=[0, -5 * AU, -10 * AU] init_position=[0, -5 * AU, -10 * AU]
) )
......
...@@ -125,7 +125,8 @@ def create_trails(parent): ...@@ -125,7 +125,8 @@ def create_trails(parent):
return return
else: else:
# 如果位置比较近,就不创建拖尾了,保证拖尾间隔一定的距离 # 如果位置比较近,就不创建拖尾了,保证拖尾间隔一定的距离
if last_pos_distance < parent.trail_scale * trail_int_scale: # 间隔距离不小于1.2倍的拖尾球体 # 间隔距离不小于1.2倍的拖尾球体
if last_pos_distance < parent.trail_scale * trail_int_scale * UrsinaConfig.trail_factor:
return return
if UrsinaConfig.trail_type == "line": if UrsinaConfig.trail_type == "line":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册