Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
a6914400
宇宙模拟器
项目概览
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看板
提交
a6914400
编写于
10月 31, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
cd95c3a4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
58 addition
and
12 deletion
+58
-12
objs/halley_comet.py
objs/halley_comet.py
+1
-0
sim_scenes/solar_system/halley_comet_sim.py
sim_scenes/solar_system/halley_comet_sim.py
+31
-4
simulators/ursina/entities/body_trail.py
simulators/ursina/entities/body_trail.py
+26
-8
未找到文件。
objs/halley_comet.py
浏览文件 @
a6914400
...
@@ -18,6 +18,7 @@ class HalleComet(RockSnow):
...
@@ -18,6 +18,7 @@ class HalleComet(RockSnow):
远日点: 35.1 AU(2023年12月9日)
远日点: 35.1 AU(2023年12月9日)
近日点: 0.586 AU 上次通过近日点:1986年2月9日 下次通过近日点:2061年7月28日
近日点: 0.586 AU 上次通过近日点:1986年2月9日 下次通过近日点:2061年7月28日
平均密度: 0.6(估计的范围在0.2至1.5g/cm)
平均密度: 0.6(估计的范围在0.2至1.5g/cm)
均密度: 1 g/cm³ -> 1✕10³ kg/m³
来源:https://www.cgmodel.com/model/500318.html
来源:https://www.cgmodel.com/model/500318.html
"""
"""
...
...
sim_scenes/solar_system/halley_comet_sim.py
浏览文件 @
a6914400
...
@@ -182,7 +182,7 @@ class HalleyCometSim:
...
@@ -182,7 +182,7 @@ class HalleyCometSim:
set_solar_system_celestial_position
(
self
.
bodies
,
t
,
False
)
set_solar_system_celestial_position
(
self
.
bodies
,
t
,
False
)
def
create_year_label
(
self
,
trail
,
year
,
halley_comet_pos
):
def
create_year_label
(
self
,
trail
,
year
,
halley_comet_pos
):
label
=
create_label
(
trail
,
label
=
year
,
pos
=
(
0
,
0
,
0
),
color
=
(
255
,
255
,
255
),
scale
=
40
,
alpha
=
1.0
)
label
=
create_label
(
trail
,
label
=
year
,
pos
=
(
0
,
0
,
0
),
color
=
(
255
,
255
,
255
),
scale
=
40
,
alpha
=
1.0
)
# label.udpate
# label.udpate
label
.
set_light_off
()
label
.
set_light_off
()
...
@@ -213,14 +213,41 @@ class HalleyCometSim:
...
@@ -213,14 +213,41 @@ class HalleyCometSim:
last_trail
.
entity_infos
[
"time"
]
=
dt
.
strftime
(
"%Y-%m-%d"
)
last_trail
.
entity_infos
[
"time"
]
=
dt
.
strftime
(
"%Y-%m-%d"
)
# print(last_trail.entity_infos)
# print(last_trail.entity_infos)
pos
=
self
.
halley_comet
.
planet
.
position
import
copy
if
not
hasattr
(
self
,
"last_year"
):
if
not
hasattr
(
self
,
"last_year"
):
self
.
create_year_label
(
last_trail
,
year
,
self
.
halley_comet
.
planet
.
position
)
self
.
create_year_label
(
last_trail
,
year
,
pos
)
elif
self
.
last_year
!=
year
:
elif
self
.
last_year
!=
year
:
self
.
create_year_label
(
last_trail
,
year
,
self
.
halley_comet
.
planet
.
position
)
if
not
hasattr
(
self
,
"last_label_pos"
):
self
.
create_year_label
(
last_trail
,
year
,
pos
)
self
.
last_label_pos
=
copy
.
deepcopy
(
self
.
halley_comet
.
position
)
else
:
# 防止标签非常紧密
d
=
calculate_distance
(
self
.
halley_comet
.
position
,
self
.
last_label_pos
)
if
d
>
AU
:
self
.
create_year_label
(
last_trail
,
year
,
pos
)
self
.
last_label_pos
=
copy
.
deepcopy
(
self
.
halley_comet
.
position
)
self
.
last_year
=
year
self
.
last_year
=
year
# 哈雷彗星离太阳最近的点称为 "perihelion of Halley's Comet"(近日点:comet_peri),
if
not
hasattr
(
self
,
"comet_peri"
):
self
.
comet_peri
=
d_sun
elif
d_sun
<
self
.
comet_peri
:
self
.
comet_peri
=
d_sun
# 哈雷彗星离太阳最远的点称为 "aphelion of Halley's Comet"(远日点)
if
not
hasattr
(
self
,
"comet_aphel"
):
self
.
comet_aphel
=
d_sun
elif
d_sun
>
self
.
comet_aphel
:
self
.
comet_aphel
=
d_sun
panel_text
=
"哈雷彗星:
\n
距离太阳:%.3f AU"
%
(
d_sun
/
AU
)
panel_text
=
"哈雷彗星:
\n
距离太阳:%.3f AU"
%
(
d_sun
/
AU
)
panel_text
+=
"
\n
离日最远:%.3f AU"
%
(
self
.
comet_aphel
/
AU
)
panel_text
+=
"
\n
离日最近:%.3f AU"
%
(
self
.
comet_peri
/
AU
)
panel_text
+=
"
\n
距离地球:%.3f AU"
%
(
d_earth
/
AU
)
panel_text
+=
"
\n
距离地球:%.3f AU"
%
(
d_earth
/
AU
)
velocity
,
_
=
get_value_direction_vectors
(
self
.
halley_comet
.
velocity
)
velocity
,
_
=
get_value_direction_vectors
(
self
.
halley_comet
.
velocity
)
panel_text
+=
"
\n
当前速度:%.3f km/s"
%
velocity
panel_text
+=
"
\n
当前速度:%.3f km/s"
%
velocity
...
@@ -288,4 +315,4 @@ if __name__ == '__main__':
...
@@ -288,4 +315,4 @@ if __name__ == '__main__':
show_control_info
=
False
,
show_control_info
=
False
,
timer_enabled
=
True
,
timer_enabled
=
True
,
show_grid
=
False
show_grid
=
False
)
)
\ No newline at end of file
simulators/ursina/entities/body_trail.py
浏览文件 @
a6914400
...
@@ -52,9 +52,13 @@ class BodyTrail(Entity):
...
@@ -52,9 +52,13 @@ class BodyTrail(Entity):
# self.origin_color = self.color
# self.origin_color = self.color
self
.
origin_alpha
=
self
.
alpha
self
.
origin_alpha
=
self
.
alpha
if
len
(
self
.
children
)
>
0
:
if
not
hasattr
(
self
,
"info_entities"
):
for
c
in
self
.
children
:
self
.
info_entities
=
[]
if
len
(
self
.
info_entities
)
>
0
:
for
c
in
self
.
info_entities
:
destroy
(
c
)
destroy
(
c
)
self
.
info_entities
=
[]
# self.color = self.origin_color
# self.color = self.origin_color
self
.
alpha
=
self
.
origin_alpha
self
.
alpha
=
self
.
origin_alpha
return
return
...
@@ -79,28 +83,42 @@ class BodyTrail(Entity):
...
@@ -79,28 +83,42 @@ class BodyTrail(Entity):
acc_info
=
"%.2fm/s²"
%
(
acc_m
)
acc_info
=
"%.2fm/s²"
%
(
acc_m
)
elif
acc_m
>=
0.00001
:
elif
acc_m
>=
0.00001
:
acc_info
=
"%.2fmm/s²"
%
(
acc_m
*
1000
)
acc_info
=
"%.2fmm/s²"
%
(
acc_m
*
1000
)
#
elif acc_m >= 0.00000001:
elif
acc_m
>=
0.00000001
:
#
acc_info = "%.2fμm/s²" % (acc_m * 1000 * 1000)
acc_info
=
"%.2fμm/s²"
%
(
acc_m
*
1000
*
1000
)
else
:
else
:
acc_info
=
"0m/s²"
acc_info
=
"0m/s²"
if
vel_value
<
0.00000001
:
if
vel_value
<
0.00000001
:
create_label
(
parent
=
self
,
label
=
vel_info
,
pos
=
Vec3
(
-
0.5
,
-
0.5
,
-
0.5
),
color
=
color
.
red
).
set_light_off
()
label
=
create_label
(
parent
=
self
,
label
=
vel_info
,
pos
=
Vec3
(
-
0.5
,
-
0.5
,
-
0.5
),
color
=
color
.
red
).
set_light_off
()
self
.
info_entities
.
append
(
label
)
# label.infos = vel_info
# v_text.parent = self
# v_text.parent = self
# # v_arrow.enabled = False
# # v_arrow.enabled = False
# # v_line.enabled = False
# # v_line.enabled = False
else
:
else
:
v_arrow
,
v_line
,
v_text
=
create_arrow_line
((
0
,
0
,
0
),
tuple
(
vel_direction
),
parent
=
self
,
v_arrow
,
v_line
,
v_text
=
create_arrow_line
((
0
,
0
,
0
),
tuple
(
vel_direction
),
parent
=
self
,
label
=
vel_info
,
color
=
color
.
red
,
alpha
=
0.8
,
arrow_scale
=
0.5
)
label
=
vel_info
,
color
=
color
.
red
,
alpha
=
0.8
,
arrow_scale
=
0.5
)
# v_arrow.infos = vel_info
if
acc_m
<
0.00001
:
# v_line.infos = vel_info
create_label
(
parent
=
self
,
label
=
acc_info
,
pos
=
Vec3
(
0.5
,
0.5
,
0.5
),
color
=
color
.
green
).
set_light_off
()
# v_text.infos = vel_info
self
.
info_entities
+=
v_arrow
,
v_line
,
v_text
if
acc_m
<
0.00000001
:
label
=
create_label
(
parent
=
self
,
label
=
acc_info
,
pos
=
Vec3
(
0.5
,
0.5
,
0.5
),
color
=
color
.
green
).
set_light_off
()
self
.
info_entities
.
append
(
label
)
# label.infos = acc_info
# a_text.parent = self
# a_text.parent = self
# a_arrow.enabled = False
# a_arrow.enabled = False
# a_line.enabled = False
# a_line.enabled = False
else
:
else
:
a_arrow
,
a_line
,
a_text
=
create_arrow_line
((
0
,
0
,
0
),
tuple
(
acc_direction
),
parent
=
self
,
a_arrow
,
a_line
,
a_text
=
create_arrow_line
((
0
,
0
,
0
),
tuple
(
acc_direction
),
parent
=
self
,
label
=
acc_info
,
color
=
color
.
green
,
alpha
=
0.8
,
arrow_scale
=
0.5
)
label
=
acc_info
,
color
=
color
.
green
,
alpha
=
0.8
,
arrow_scale
=
0.5
)
self
.
info_entities
+=
a_arrow
,
a_line
,
a_text
# a_arrow.infos = acc_info
# a_line.infos = acc_info
# a_text.infos = acc_info
class
BodyTrailLine_OK
(
Entity
):
class
BodyTrailLine_OK
(
Entity
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录