diff --git a/scenes/solar_system_2.py b/scenes/solar_system_2.py index 1a835d536cae5d875b287b58c154d13d13d0d105..a268c180688ed692fdcccd9f567dd2982813b0b3 100644 --- a/scenes/solar_system_2.py +++ b/scenes/solar_system_2.py @@ -28,7 +28,7 @@ if __name__ == '__main__': Mercury(size_scale=4e3, distance_scale=1.3), # 水星放大 4000 倍,距离放大 1.3 倍 Venus(size_scale=4e3, distance_scale=1.3), # 金星放大 4000 倍,距离放大 1.3 倍 Earth(size_scale=4e3, distance_scale=1.3), # 地球放大 4000 倍,距离放大 1.3 倍 - Asteroids(size_scale=3e2, parent=sun), # 小行星模拟 + Asteroids(size_scale=3e2, parent=sun), # 小行星模拟(仅 ursina 模拟器支持) Mars(size_scale=4e3, distance_scale=1.3), # 火星放大 4000 倍,距离放大 1.3 倍 Jupiter(size_scale=0.68e3, distance_scale=0.65), # 木星放大 680 倍,距离缩小到真实距离的 0.65 Saturn(size_scale=0.68e3, distance_scale=0.52), # 土星放大 680 倍,距离缩小到真实距离的 0.52 diff --git a/simulators/mpl_simulator.py b/simulators/mpl_simulator.py index 3b41e3369802f64d373eaf0e3588f7cb55c702d4..035735715dd20657abeb686caed90a96a25d6f97 100644 --- a/simulators/mpl_simulator.py +++ b/simulators/mpl_simulator.py @@ -94,6 +94,10 @@ class MplSimulator(Simulator): update_ax(ax, styles) for idx, body in enumerate(bodies): + if hasattr(body, "torus_stars"): + # 暂不支持环状小行星群 + continue + if body.is_fixed_star: color = 'red' else: @@ -116,7 +120,7 @@ class MplSimulator(Simulator): ax.plot3D(_his_pos[0], _his_pos[1], _his_pos[2], color=color, alpha=0.5) z_range = ax.get_zlim()[1] - ax.get_zlim()[0] - ax.text(pos[0], pos[1], pos[2] + size*(z_range/5000), s=body.name, color=color, fontsize=12) + ax.text(pos[0], pos[1], pos[2] + size * (z_range / 5000), s=body.name, color=color, fontsize=12) if pause > 0: plt.pause(pause) diff --git a/simulators/views/mayavi_view.py b/simulators/views/mayavi_view.py index 8a78bbdc3a5313ef9f4b4381f945539f27a56e28..c0d0f9b717f0f3818560c62afab72c8eda84b6da 100644 --- a/simulators/views/mayavi_view.py +++ b/simulators/views/mayavi_view.py @@ -85,6 +85,10 @@ class MayaviView(BodyView): 天体显示的操作,比如:构建天体视图对象 :return: """ + if hasattr(self.body, "torus_stars"): + # 暂不支持环状小行星群 + return + if not hasattr(self, "sphere") or self.sphere is None: scale_factor = self.body.size_scale * self.body.diameter sphere = mlab.points3d(self.body.position[0], self.body.position[1], self.body.position[2], @@ -130,7 +134,7 @@ class MayaviView(BodyView): :param image_file: :return: """ - outfile = image_file.replace('.jpg', '_flipped.jpg') + outfile = image_file.replace('.jpg', '_flipped.jpg').replace('.png', '_flipped.jpg') if os.path.exists(outfile): image_file = outfile else: diff --git a/simulators/views/mpl_view.py b/simulators/views/mpl_view.py index 54555e5971939ff2e9e37db15abf3c5e787cea0a..7995577c96616a28adf4ac73d71a1de9f14d2fcf 100644 --- a/simulators/views/mpl_view.py +++ b/simulators/views/mpl_view.py @@ -23,7 +23,9 @@ class MplView(BodyView): pass def appear(self): - pass + if hasattr(self.body, "torus_stars"): + # 暂不支持环状小行星群 + return def disappear(self): - pass \ No newline at end of file + pass