Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
b2cf7e80
宇宙模拟器
项目概览
Python_超人
/
宇宙模拟器
通知
19
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
宇宙模拟器
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b2cf7e80
编写于
11月 17, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
de90141b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
4 deletion
+29
-4
sim_scenes/solar_system/halley_comet_lib.py
sim_scenes/solar_system/halley_comet_lib.py
+5
-1
sim_scenes/solar_system/sun_earth.py
sim_scenes/solar_system/sun_earth.py
+24
-3
未找到文件。
sim_scenes/solar_system/halley_comet_lib.py
浏览文件 @
b2cf7e80
...
@@ -90,7 +90,11 @@ class HalleyCometSimBase(UniverseSimScenes):
...
@@ -90,7 +90,11 @@ class HalleyCometSimBase(UniverseSimScenes):
def
build_solar_system
(
self
,
ignore_gravity
=
False
,
start_time
=
None
):
def
build_solar_system
(
self
,
ignore_gravity
=
False
,
start_time
=
None
):
# region 构建太阳系
# region 构建太阳系
show_trail
=
False
show_trail
=
False
self
.
sun
=
Sun
(
size_scale
=
0.6e2
,
show_trail
=
show_trail
,
texture
=
"sun_light.jpg"
)
self
.
sun
=
Sun
(
size_scale
=
0.6e2
,
show_trail
=
show_trail
,
# color=(255, 250, 245),
# texture="",
texture
=
"sun_light.jpg"
)
self
.
mercury
=
Mercury
(
size_scale
=
5e3
,
show_trail
=
show_trail
)
self
.
mercury
=
Mercury
(
size_scale
=
5e3
,
show_trail
=
show_trail
)
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
)
...
...
sim_scenes/solar_system/sun_earth.py
浏览文件 @
b2cf7e80
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
from
bodies
import
Sun
,
Earth
,
Sirius
from
bodies
import
Sun
,
Earth
,
Sirius
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
,
AU
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
,
AU
from
sim_scenes.func
import
mayavi_run
,
ursina_run
from
sim_scenes.func
import
mayavi_run
,
ursina_run
from
simulators.ursina.ursina_event
import
UrsinaEvent
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
"""
"""
...
@@ -19,10 +20,30 @@ if __name__ == '__main__':
...
@@ -19,10 +20,30 @@ if __name__ == '__main__':
Earth
(
size_scale
=
2e3
,
distance_scale
=
1
),
# 地球放大 2000 倍,距离保持不变
Earth
(
size_scale
=
2e3
,
distance_scale
=
1
),
# 地球放大 2000 倍,距离保持不变
]
]
# 使用 mayavi 查看的运行效果
circle
=
None
# mayavi_run(bodies, SECONDS_PER_WEEK, view_azimuth=-45)
def
on_ready
():
global
circle
from
simulators.ursina.ursina_mesh
import
create_circle
from
ursina
import
camera
# circle = create_circle(parent=None, scale=1e2)
# circle.set_light_off(True)
def
on_timer_changed
(
time_data
):
global
circle
from
ursina
import
camera
# circle.look_at(camera)
# circle.rotation_y = 90
# 运行中,每时每刻都会触发 on_timer_changed
UrsinaEvent
.
on_timer_changed_subscription
(
on_timer_changed
)
# 运行前会触发 on_ready
UrsinaEvent
.
on_ready_subscription
(
on_ready
)
# 使用 ursina 查看的运行效果
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_WEEK
,
position
=
(
0
,
AU
,
-
4
*
AU
),
show_trail
=
True
)
ursina_run
(
bodies
,
SECONDS_PER_WEEK
,
position
=
(
0
,
AU
,
-
4
*
AU
),
timer_enabled
=
True
,
show_trail
=
True
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录