From 8b5358afbb5e3c19f17cefce039b2b33eb5edaed Mon Sep 17 00:00:00 2001 From: march3 <13505732@qq.com> Date: Sat, 11 Feb 2023 15:25:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E4=BD=93=E8=BF=90=E8=A1=8C=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simulators/mayavi_simulator.py | 20 ++++++++++++++++++-- simulators/mpl_simulator.py | 4 ++-- simulators/simulator.py | 4 ++-- simulators/views/body_view.py | 4 ++-- simulators/views/mayavi_view.py | 4 ++-- simulators/views/mpl_view.py | 4 ++-- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/simulators/mayavi_simulator.py b/simulators/mayavi_simulator.py index 85b3f62..5e5c29c 100644 --- a/simulators/mayavi_simulator.py +++ b/simulators/mayavi_simulator.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- -# title : -# description : +# title :Mayavi天体运行模拟器 +# description :Mayavi天体运行模拟器 # author :Python超人 # date :2023-02-11 # link :https://gitcode.net/pythoncr/ @@ -16,6 +16,7 @@ class MayaviSimulator(Simulator): """ Mayavi天体运行模拟器 """ + def __init__(self, bodies_sys: System): super().__init__(bodies_sys, MayaviView) @@ -27,3 +28,18 @@ class MayaviSimulator(Simulator): # Updating scene... f.scene.render() yield + + +if __name__ == '__main__': + from scenes.func import mayavi_run + from bodies import Sun, Earth + from common.consts import SECONDS_PER_WEEK + + """ + 太阳、地球 + """ + bodies = [ + Sun(size_scale=1.2e2), # 太阳放大 120 倍 + Earth(size_scale=4e3, distance_scale=1), # 地球放大 4000 倍,距离保持不变 + ] + mayavi_run(bodies, SECONDS_PER_WEEK) diff --git a/simulators/mpl_simulator.py b/simulators/mpl_simulator.py index b594d00..beaeb5a 100644 --- a/simulators/mpl_simulator.py +++ b/simulators/mpl_simulator.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- -# title : -# description : +# title :matplotlib天体运行模拟器 +# description :matplotlib天体运行模拟器 # author :Python超人 # date :2023-02-11 # link :https://gitcode.net/pythoncr/ diff --git a/simulators/simulator.py b/simulators/simulator.py index 302ce86..78bd693 100644 --- a/simulators/simulator.py +++ b/simulators/simulator.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- -# title : -# description : +# title :天体运行模拟器 +# description :天体运行模拟器 # author :Python超人 # date :2023-02-11 # link :https://gitcode.net/pythoncr/ diff --git a/simulators/views/body_view.py b/simulators/views/body_view.py index 0275935..c7d797c 100644 --- a/simulators/views/body_view.py +++ b/simulators/views/body_view.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- -# title : -# description : +# title :天体视图 +# description :天体视图(天体效果展示用) # author :Python超人 # date :2023-02-11 # link :https://gitcode.net/pythoncr/ diff --git a/simulators/views/mayavi_view.py b/simulators/views/mayavi_view.py index 2e1cdd8..8a78bbd 100644 --- a/simulators/views/mayavi_view.py +++ b/simulators/views/mayavi_view.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- -# title : -# description : +# title :Mayavi天体视图 +# description :Mayavi天体视图(天体效果展示用,需要安装 mayavi) # author :Python超人 # date :2023-02-11 # link :https://gitcode.net/pythoncr/ diff --git a/simulators/views/mpl_view.py b/simulators/views/mpl_view.py index f714e23..54555e5 100644 --- a/simulators/views/mpl_view.py +++ b/simulators/views/mpl_view.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- -# title : -# description : +# title :matplotlib天体视图 +# description :matplotlib天体视图(天体效果展示用) # author :Python超人 # date :2023-02-11 # link :https://gitcode.net/pythoncr/ -- GitLab