Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
1147b3b1
宇宙模拟器
项目概览
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看板
提交
1147b3b1
编写于
10月 25, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
9baff751
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
10 deletion
+13
-10
sim_scenes/solar_system/halley_comet_sim.py
sim_scenes/solar_system/halley_comet_sim.py
+13
-10
未找到文件。
sim_scenes/solar_system/halley_comet_sim.py
浏览文件 @
1147b3b1
...
...
@@ -13,8 +13,9 @@ from ursina import camera, application
from
bodies
import
Sun
,
Mercury
,
Venus
,
Earth
,
Mars
,
Jupiter
,
Saturn
,
Uranus
,
Neptune
,
Pluto
from
common.celestial_data_service
import
get_init_pos_vels
,
init_bodies_pos_vels
from
common.consts
import
SECONDS_PER_YEAR
,
AU
from
common.func
import
calculate_distance
from
objs
import
HalleComet
,
Obj
from
sim_scenes.func
import
camera_look_at
,
two_bodies_colliding
from
sim_scenes.func
import
camera_look_at
,
two_bodies_colliding
,
create_text_panel
from
sim_scenes.func
import
ursina_run
,
create_sphere_sky
from
simulators.ursina.ursina_event
import
UrsinaEvent
...
...
@@ -34,7 +35,7 @@ class HalleyCometSim:
self
.
sun
,
# 太阳放大 80 倍
# 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, rotate_angle=0), # 地球放大 4000 倍,距离放大 1.3 倍
Earth
(
size_scale
=
4e3
,
distance_scale
=
1.3
,
rotate_angle
=
0
),
# 地球放大 4000 倍,距离放大 1.3 倍
# Mars(size_scale=4e3, distance_scale=1.2), # 火星放大 4000 倍,距离放大 1.2 倍
Jupiter
(
size_scale
=
1.68e3
,
distance_scale
=
1
),
# 木星放大 680 倍,距离缩小到真实距离的 0.72
Saturn
(
size_scale
=
1.68e3
,
distance_scale
=
1
),
# 土星放大 680 倍,距离缩小到真实距离的 0.52
...
...
@@ -55,16 +56,17 @@ class HalleyCometSim:
# 每76.1年环绕太阳一周的周期彗星
# 3.335, 0, 10.7 73
# 3.33, 0, 10.7 73
self
.
halley_comet
=
HalleComet
(
# size_scale=4e7,
size_scale
=
1e8
,
init_velocity
=
[
3.33
,
0
,
10.65
],
# [3.33, 0, 10.6] < ? <[3.34, 0, 10.7]
init_position
=
[
0
,
0.5
*
AU
,
-
10
*
AU
])
\
# [3.33, 0, 10.65] 71
# [3.33, 0, 10.655] 68
# [3.33, 0, 10.66] 69
self
.
halley_comet
=
HalleComet
(
# size_scale=4e7,
size_scale
=
1e8
,
init_velocity
=
[
3.33
,
0
,
10.699
],
# [3.33, 0, 10.6] < ? <[3.34, 0, 10.7]
init_position
=
[
0
,
0.5
*
AU
,
-
10
*
AU
])
\
.
set_light_disable
(
True
)
self
.
bodies
.
append
(
self
.
halley_comet
)
def
build
(
self
):
self
.
build_solar_system
()
self
.
build_halley_comet
()
...
...
@@ -80,7 +82,7 @@ class HalleyCometSim:
create_sphere_sky
(
scale
=
200000
)
application
.
time_scale
=
5
self
.
text_panel
=
create_text_panel
()
def
on_timer_changed
(
self
,
time_data
):
"""
...
...
@@ -94,7 +96,8 @@ class HalleyCometSim:
self
.
halley_comet
.
planet
.
rotation_y
+=
1
# 摄像机始终看向二向箔
# camera_look_at(self.halley_comet)
d
=
calculate_distance
(
self
.
halley_comet
.
position
,
self
.
sun
.
position
)
self
.
text_panel
.
text
=
"哈雷彗星距离太阳:%.3f AU"
%
(
d
/
AU
)
if
__name__
==
'__main__'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录