Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
03c9e3af
宇宙模拟器
项目概览
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看板
提交
03c9e3af
编写于
3月 24, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
55c3f312
变更
39
显示空白变更内容
内联
并排
Showing
39 changed file
with
190 addition
and
73 deletion
+190
-73
bodies/earth.py
bodies/earth.py
+3
-2
bodies/fixed_stars/alcyone.py
bodies/fixed_stars/alcyone.py
+3
-2
bodies/fixed_stars/aldebaran.py
bodies/fixed_stars/aldebaran.py
+3
-2
bodies/fixed_stars/antares.py
bodies/fixed_stars/antares.py
+3
-2
bodies/fixed_stars/arcturus.py
bodies/fixed_stars/arcturus.py
+3
-2
bodies/fixed_stars/bellatrix.py
bodies/fixed_stars/bellatrix.py
+3
-2
bodies/fixed_stars/betelgeuse.py
bodies/fixed_stars/betelgeuse.py
+3
-2
bodies/fixed_stars/carinae_v382.py
bodies/fixed_stars/carinae_v382.py
+3
-2
bodies/fixed_stars/eta_carinae.py
bodies/fixed_stars/eta_carinae.py
+3
-2
bodies/fixed_stars/fixed_star.py
bodies/fixed_stars/fixed_star.py
+3
-2
bodies/fixed_stars/pollux.py
bodies/fixed_stars/pollux.py
+3
-2
bodies/fixed_stars/procyon.py
bodies/fixed_stars/procyon.py
+3
-2
bodies/fixed_stars/rigel.py
bodies/fixed_stars/rigel.py
+3
-2
bodies/fixed_stars/sirius.py
bodies/fixed_stars/sirius.py
+3
-2
bodies/fixed_stars/stephenson_2_18.py
bodies/fixed_stars/stephenson_2_18.py
+2
-1
bodies/fixed_stars/uy_scuti.py
bodies/fixed_stars/uy_scuti.py
+3
-2
bodies/fixed_stars/vy_canis_majoris.py
bodies/fixed_stars/vy_canis_majoris.py
+2
-1
bodies/fixed_stars/y_canum_venaticorum.py
bodies/fixed_stars/y_canum_venaticorum.py
+3
-2
bodies/jupiter.py
bodies/jupiter.py
+3
-2
bodies/mars.py
bodies/mars.py
+3
-2
bodies/mercury.py
bodies/mercury.py
+3
-2
bodies/moon.py
bodies/moon.py
+3
-2
bodies/neptune.py
bodies/neptune.py
+3
-2
bodies/pluto.py
bodies/pluto.py
+3
-2
bodies/saturn.py
bodies/saturn.py
+3
-2
bodies/sun.py
bodies/sun.py
+3
-2
bodies/uranus.py
bodies/uranus.py
+3
-2
bodies/venus.py
bodies/venus.py
+3
-2
common/func.py
common/func.py
+26
-2
sim_scenes/fiction/fixed_stars.py
sim_scenes/fiction/fixed_stars.py
+1
-1
sim_scenes/fiction/sun_dysen_sphere.py
sim_scenes/fiction/sun_dysen_sphere.py
+2
-1
sim_scenes/solar_system/earth_at_night.py
sim_scenes/solar_system/earth_at_night.py
+2
-2
sim_scenes/solar_system/hd_mercury.py
sim_scenes/solar_system/hd_mercury.py
+2
-2
sim_scenes/solar_system/hd_pluto.py
sim_scenes/solar_system/hd_pluto.py
+25
-0
sim_scenes/solar_system/hd_venus.py
sim_scenes/solar_system/hd_venus.py
+25
-0
sim_scenes/solar_system/solar_system_1.py
sim_scenes/solar_system/solar_system_1.py
+1
-1
sim_scenes/solar_system/solar_system_3.py
sim_scenes/solar_system/solar_system_3.py
+11
-7
simulators/ursina_simulator.py
simulators/ursina_simulator.py
+6
-1
simulators/views/ursina_view.py
simulators/views/ursina_view.py
+7
-2
未找到文件。
bodies/earth.py
浏览文件 @
03c9e3af
...
...
@@ -27,7 +27,7 @@ class Earth(Body):
init_position
=
[
1.12
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
29.79
,
0
],
texture
=
"earth1.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
15
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=
15
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -40,7 +40,8 @@ class Earth(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/alcyone.py
浏览文件 @
03c9e3af
...
...
@@ -76,7 +76,7 @@ class Alcyone(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xBB
,
0xAA
,
0xFF
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.45
,
ignore_mass
=
False
):
rotation_speed
=
0.45
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -88,7 +88,8 @@ class Alcyone(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/aldebaran.py
浏览文件 @
03c9e3af
...
...
@@ -59,7 +59,7 @@ class Aldebaran(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
250
,
195
,
47
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.35
,
ignore_mass
=
False
):
rotation_speed
=
0.35
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -71,7 +71,8 @@ class Aldebaran(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/antares.py
浏览文件 @
03c9e3af
...
...
@@ -60,7 +60,7 @@ class Antares(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
249
,
198
,
83
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.25
,
ignore_mass
=
False
):
rotation_speed
=
0.25
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -72,7 +72,8 @@ class Antares(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
self
.
glows
=
6
...
...
bodies/fixed_stars/arcturus.py
浏览文件 @
03c9e3af
...
...
@@ -53,7 +53,7 @@ class Arcturus(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
254
,
218
,
185
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.4
,
ignore_mass
=
False
):
rotation_speed
=
0.4
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -65,7 +65,8 @@ class Arcturus(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/bellatrix.py
浏览文件 @
03c9e3af
...
...
@@ -55,7 +55,7 @@ class Bellatrix(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
122
,
187
,
255
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.5
,
ignore_mass
=
False
):
rotation_speed
=
0.5
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -67,7 +67,8 @@ class Bellatrix(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/betelgeuse.py
浏览文件 @
03c9e3af
...
...
@@ -57,7 +57,7 @@ class Betelgeuse(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
254
,
162
,
1
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.24
,
ignore_mass
=
False
):
rotation_speed
=
0.24
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -69,7 +69,8 @@ class Betelgeuse(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/carinae_v382.py
浏览文件 @
03c9e3af
...
...
@@ -56,7 +56,7 @@ class CarinaeV382(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
255
,
172
,
40
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.26
,
ignore_mass
=
False
):
rotation_speed
=
0.26
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -68,7 +68,8 @@ class CarinaeV382(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/eta_carinae.py
浏览文件 @
03c9e3af
...
...
@@ -50,7 +50,7 @@ class EtaCarinae(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
111
,
140
,
255
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.28
,
ignore_mass
=
False
):
rotation_speed
=
0.28
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -62,7 +62,8 @@ class EtaCarinae(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/fixed_star.py
浏览文件 @
03c9e3af
...
...
@@ -28,7 +28,7 @@ class FixedStar(Body):
color
=
(
0xFF
,
0xFF
,
0xFF
),
texture
=
None
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
,
density
=
1.408e3
,
trail_color
=
None
,
texture_bright
=
None
,
texture_contrast
=
None
):
texture_bright
=
None
,
texture_contrast
=
None
,
show_name
=
False
):
if
texture
is
None
or
texture
==
"fixed_star.png"
:
self
.
color
=
color
# bright=1.1, contrast=3.2
...
...
@@ -45,7 +45,8 @@ class FixedStar(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
self
.
light_on
=
True
...
...
bodies/fixed_stars/pollux.py
浏览文件 @
03c9e3af
...
...
@@ -59,7 +59,7 @@ class Pollux(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xF5
,
0xE8
,
0xD5
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
rotation_speed
=
0.1
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -71,7 +71,8 @@ class Pollux(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/procyon.py
浏览文件 @
03c9e3af
...
...
@@ -77,7 +77,7 @@ class Procyon(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xF5
,
0xE8
,
0xD5
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.1
,
ignore_mass
=
False
):
rotation_speed
=
0.1
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -89,7 +89,8 @@ class Procyon(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/rigel.py
浏览文件 @
03c9e3af
...
...
@@ -53,7 +53,7 @@ class Rigel(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
200
,
200
,
255
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.33
,
ignore_mass
=
False
):
rotation_speed
=
0.33
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -65,7 +65,8 @@ class Rigel(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
self
.
glows
=
7
...
...
bodies/fixed_stars/sirius.py
浏览文件 @
03c9e3af
...
...
@@ -79,7 +79,7 @@ class Sirius(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
0xFF
,
0xFF
,
0xFF
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.55
,
ignore_mass
=
False
):
rotation_speed
=
0.55
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -91,7 +91,8 @@ class Sirius(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/stephenson_2_18.py
浏览文件 @
03c9e3af
...
...
@@ -62,7 +62,7 @@ class Stephenson_2_18(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
198
,
29
,
3
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.2
,
ignore_mass
=
False
):
rotation_speed
=
0.2
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -75,6 +75,7 @@ class Stephenson_2_18(FixedStar):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
,
"texture_bright"
:
3
,
"texture_contrast"
:
4
}
...
...
bodies/fixed_stars/uy_scuti.py
浏览文件 @
03c9e3af
...
...
@@ -53,7 +53,7 @@ class UYScuti(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
255
,
116
,
0
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.22
,
ignore_mass
=
False
):
rotation_speed
=
0.22
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -65,7 +65,8 @@ class UYScuti(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/fixed_stars/vy_canis_majoris.py
浏览文件 @
03c9e3af
...
...
@@ -54,7 +54,7 @@ class VYCanisMajoris(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
234
,
90
,
65
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.23
,
ignore_mass
=
False
):
rotation_speed
=
0.23
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -67,6 +67,7 @@ class VYCanisMajoris(FixedStar):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
,
"texture_bright"
:
2
,
"texture_contrast"
:
3
}
...
...
bodies/fixed_stars/y_canum_venaticorum.py
浏览文件 @
03c9e3af
...
...
@@ -54,7 +54,7 @@ class YCanumVenaticorum(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
255
,
55
,
18
),
texture
=
"fixed_star.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.3
,
ignore_mass
=
False
):
rotation_speed
=
0.3
,
ignore_mass
=
False
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -66,7 +66,8 @@ class YCanumVenaticorum(FixedStar):
"size_scale"
:
size_scale
,
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
"ignore_mass"
:
ignore_mass
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/jupiter.py
浏览文件 @
03c9e3af
...
...
@@ -27,7 +27,7 @@ class Jupiter(Body):
init_position
=
[
5.2
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
13.06
,
0
],
texture
=
"jupiter1.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
36.2537
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=
36.2537
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -40,7 +40,8 @@ class Jupiter(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/mars.py
浏览文件 @
03c9e3af
...
...
@@ -26,7 +26,7 @@ class Mars(Body):
init_position
=
[
1.5
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
24.13
,
0
],
texture
=
"mars.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
14.6223
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=
14.6223
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -39,7 +39,8 @@ class Mars(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/mercury.py
浏览文件 @
03c9e3af
...
...
@@ -27,7 +27,7 @@ class Mercury(Body):
init_position
=
[
0.4
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
47.87
,
0
],
texture
=
"mercury.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.2558
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=
0.2558
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -40,7 +40,8 @@ class Mercury(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/moon.py
浏览文件 @
03c9e3af
...
...
@@ -26,7 +26,7 @@ class Moon(Body):
init_position
=
[
363104
+
1.12
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
29.79
+
1.023
,
0
],
texture
=
"moon.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.5487
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=
0.5487
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -39,7 +39,8 @@ class Moon(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/neptune.py
浏览文件 @
03c9e3af
...
...
@@ -27,7 +27,7 @@ class Neptune(Body):
init_position
=
[
30
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
5.43
,
0
],
texture
=
"neptune.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
22.3463
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=
22.3463
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -40,7 +40,8 @@ class Neptune(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/pluto.py
浏览文件 @
03c9e3af
...
...
@@ -27,7 +27,7 @@ class Pluto(Body):
init_position
=
[
40
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
4.7
,
0
],
texture
=
"pluto.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=-
2.3474
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=-
2.3474
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -40,7 +40,8 @@ class Pluto(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/saturn.py
浏览文件 @
03c9e3af
...
...
@@ -27,7 +27,7 @@ class Saturn(Body):
init_position
=
[
10
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
9.64
,
0
],
texture
=
"saturn.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
33.7711
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=
33.7711
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -40,7 +40,8 @@ class Saturn(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/sun.py
浏览文件 @
03c9e3af
...
...
@@ -23,7 +23,7 @@ class Sun(FixedStar):
init_velocity
=
[
0
,
0
,
0
],
color
=
(
170
,
98
,
25
),
texture
=
"sun2.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=
0.6130
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=
0.6130
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -36,7 +36,8 @@ class Sun(FixedStar):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/uranus.py
浏览文件 @
03c9e3af
...
...
@@ -27,7 +27,7 @@ class Uranus(Body):
init_position
=
[
19
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
6.81
,
0
],
texture
=
"uranus.png"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=-
20.8816
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=-
20.8816
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -40,7 +40,8 @@ class Uranus(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
bodies/venus.py
浏览文件 @
03c9e3af
...
...
@@ -27,7 +27,7 @@ class Venus(Body):
init_position
=
[
0.72
*
AU
,
0
,
0
],
init_velocity
=
[
0
,
35
,
0
],
texture
=
"venus.jpg"
,
size_scale
=
1.0
,
distance_scale
=
1.0
,
rotation_speed
=-
0.0617
,
ignore_mass
=
False
,
trail_color
=
None
):
rotation_speed
=-
0.0617
,
ignore_mass
=
False
,
trail_color
=
None
,
show_name
=
False
):
params
=
{
"name"
:
name
,
"mass"
:
mass
,
...
...
@@ -40,7 +40,8 @@ class Venus(Body):
"distance_scale"
:
distance_scale
,
"rotation_speed"
:
rotation_speed
,
"ignore_mass"
:
ignore_mass
,
"trail_color"
:
trail_color
"trail_color"
:
trail_color
,
"show_name"
:
show_name
}
super
().
__init__
(
**
params
)
...
...
common/func.py
浏览文件 @
03c9e3af
...
...
@@ -10,6 +10,7 @@ from PIL import Image
from
common.consts
import
AU
import
numpy
as
np
import
random
import
os
def
get_dominant_colors
(
infile
,
resize
=
(
20
,
20
)):
...
...
@@ -35,7 +36,7 @@ def get_dominant_colors(infile, resize=(20, 20)):
colors
=
list
()
for
i
in
range
(
min
(
10
,
len
(
color_counts
))):
for
i
in
range
(
min
(
10
,
len
(
color_counts
))):
palette_index
=
color_counts
[
i
][
1
]
dominant_color
=
palette
[
palette_index
*
3
:
palette_index
*
3
+
3
]
colors
.
append
(
tuple
(
dominant_color
))
...
...
@@ -72,6 +73,28 @@ def get_positions_velocitys(angles, velocity=1, radius=1, radius_offset=None, ve
return
np
.
round
(
pxs
,
2
),
np
.
round
(
pys
,
2
),
-
np
.
round
(
vxs
,
2
),
np
.
round
(
vys
,
2
)
def
find_file
(
file_path
,
default_val
=
None
,
find_deep
=
5
):
"""
代码可能会放到任意级别的目录下面,该函数能逐级往上级目录进行查找文件
@param file_path: 文件路径
@param default_val: 没有找到路径的默认值
@param find_deep: 查找深度
@return:
"""
if
file_path
is
None
:
return
default_val
if
os
.
path
.
exists
(
file_path
):
return
os
.
path
.
normpath
(
file_path
)
for
i
in
range
(
find_deep
):
file_path
=
os
.
path
.
join
(
".."
,
file_path
)
if
os
.
path
.
exists
(
file_path
):
return
os
.
path
.
normpath
(
file_path
)
return
default_val
def
calculate_distance
(
pos1
,
pos2
=
[
0
,
0
,
0
]):
"""
计算两点间的距离
...
...
@@ -86,4 +109,5 @@ def calculate_distance(pos1, pos2=[0, 0, 0]):
if
__name__
==
'__main__'
:
print
(
calculate_distance
([
6
,
8
,
0
],
[
3
,
4
,
0
]))
# print(calculate_distance([6, 8, 0], [3, 4, 0]))
print
(
find_file
(
"common/func.py"
))
sim_scenes/fiction/fixed_stars.py
浏览文件 @
03c9e3af
...
...
@@ -55,4 +55,4 @@ if __name__ == '__main__':
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_WEEK
,
position
=
(
0
,
AU
,
-
AU
/
500
),
show_name
=
True
,
bg_music
=
"
../
sounds/universe_03.mp3"
)
show_name
=
True
,
bg_music
=
"sounds/universe_03.mp3"
)
sim_scenes/fiction/sun_dysen_sphere.py
浏览文件 @
03c9e3af
...
...
@@ -27,4 +27,5 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_WEEK
,
position
=
(
0
,
AU
/
4
,
-
2
*
AU
),
bg_music
=
"../sounds/universe_02.mp3"
)
ursina_run
(
bodies
,
SECONDS_PER_WEEK
,
position
=
(
0
,
AU
/
4
,
-
2
*
AU
),
bg_music
=
"sounds/universe_02.mp3"
)
sim_scenes/solar_system/earth_at_night.py
浏览文件 @
03c9e3af
...
...
@@ -12,7 +12,7 @@ from sim_scenes.func import ursina_run
if
__name__
==
'__main__'
:
"""
高清水星
模拟运行
地球晚上
模拟运行
"""
bodies
=
[
Earth
(
texture
=
"earth_at_night.jpg"
,
...
...
@@ -22,4 +22,4 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_HOUR
/
2
,
position
=
(
0
,
200000
,
-
2000000
),
cosmic_bg
=
"
../
textures/cosmic2.jpg"
)
ursina_run
(
bodies
,
SECONDS_PER_HOUR
/
2
,
position
=
(
0
,
200000
,
-
2000000
),
cosmic_bg
=
"textures/cosmic2.jpg"
)
sim_scenes/solar_system/
mercury_hd
.py
→
sim_scenes/solar_system/
hd_mercury
.py
浏览文件 @
03c9e3af
...
...
@@ -17,9 +17,9 @@ if __name__ == '__main__':
bodies
=
[
Mercury
(
texture
=
"mercury_hd.tif"
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
100
)
size_scale
=
100
,
show_name
=
True
)
]
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_DAY
,
position
=
(
0
,
30000
,
-
600000
),
cosmic_bg
=
"../
textures/cosmic1.jpg"
)
ursina_run
(
bodies
,
SECONDS_PER_DAY
,
position
=
(
0
,
30000
,
-
700000
),
cosmic_bg
=
"
textures/cosmic1.jpg"
)
sim_scenes/solar_system/hd_pluto.py
0 → 100644
浏览文件 @
03c9e3af
# -*- coding:utf-8 -*-
# title :高清冥王星模拟运行
# description :高清冥王星模拟运行
# author :Python超人
# date :2023-02-11
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
Pluto
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
from
sim_scenes.func
import
ursina_run
if
__name__
==
'__main__'
:
"""
高清冥王星模拟运行
"""
bodies
=
[
Pluto
(
texture
=
"pluto_hd.jpg"
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
100
,
show_name
=
True
)
]
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_DAY
,
position
=
(
0
,
10000
,
-
450000
),
cosmic_bg
=
"textures/cosmic1.jpg"
)
sim_scenes/solar_system/hd_venus.py
0 → 100644
浏览文件 @
03c9e3af
# -*- coding:utf-8 -*-
# title :高清金星模拟运行
# description :高清金星模拟运行
# author :Python超人
# date :2023-02-11
# link :https://gitcode.net/pythoncr/
# python_version :3.8
# ==============================================================================
from
bodies
import
Venus
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
from
sim_scenes.func
import
ursina_run
if
__name__
==
'__main__'
:
"""
高清金星模拟运行
"""
bodies
=
[
Venus
(
texture
=
"venus_hd.jpg"
,
init_position
=
[
0
,
0
,
0
],
init_velocity
=
[
0
,
0
,
0
],
size_scale
=
100
,
show_name
=
True
)
]
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_DAY
,
position
=
(
0
,
30000
,
-
1500000
),
cosmic_bg
=
"textures/cosmic1.jpg"
)
sim_scenes/solar_system/solar_system_1.py
浏览文件 @
03c9e3af
...
...
@@ -42,4 +42,4 @@ if __name__ == '__main__':
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_YEAR
,
position
=
(
0
,
2
*
AU
,
-
11
*
AU
),
bg_music
=
"
../
sounds/universe_04.mp3"
)
ursina_run
(
bodies
,
SECONDS_PER_YEAR
,
position
=
(
0
,
2
*
AU
,
-
11
*
AU
),
bg_music
=
"sounds/universe_04.mp3"
)
sim_scenes/solar_system/solar_system_3.py
浏览文件 @
03c9e3af
...
...
@@ -7,10 +7,9 @@
# python_version :3.8
# ==============================================================================
from
bodies
import
Sun
,
Mercury
,
Venus
,
Earth
,
Mars
,
Jupiter
,
Saturn
,
Uranus
,
Neptune
,
Pluto
,
Asteroid
from
bodies.body
import
AU
from
common.consts
import
SECONDS_PER_WEEK
from
common.func
import
get_positions_velocitys
from
sim_scenes.func
import
mayavi_run
from
common.consts
import
SECONDS_PER_WEEK
,
SECONDS_PER_DAY
,
SECONDS_PER_MONTH
,
SECONDS_PER_YEAR
,
AU
from
sim_scenes.func
import
mayavi_run
,
ursina_run
import
numpy
as
np
if
__name__
==
'__main__'
:
...
...
@@ -46,10 +45,10 @@ if __name__ == '__main__':
# ]
# endregion 1 --------------------------
# region 2.随机构建
6
0 小行星,注意:太多的小行星会影响电脑性能
NUM_OF_ASTEROIDS
=
6
0
# region 2.随机构建
1
0 小行星,注意:太多的小行星会影响电脑性能
NUM_OF_ASTEROIDS
=
1
0
asteroids
=
[]
angles
=
np
.
linspace
(
0
,
4
0
*
np
.
pi
,
NUM_OF_ASTEROIDS
)
angles
=
np
.
linspace
(
0
,
10
0
*
np
.
pi
,
NUM_OF_ASTEROIDS
)
pxs
,
pys
,
vxs
,
vys
=
get_positions_velocitys
(
angles
,
radius
=
1.60
*
AU
,
velocity
=
23.37
,
...
...
@@ -82,4 +81,9 @@ if __name__ == '__main__':
# 使用 mayavi 查看的运行效果
# mayavi_run(bodies, SECONDS_PER_WEEK, view_azimuth=-45)
mayavi_run
(
bodies
,
SECONDS_PER_WEEK
,
view_azimuth
=-
45
,
view_distance
=
3e9
,
view_focalpoint
=
[
5e2
,
5e2
,
5e2
])
# mayavi_run(bodies, SECONDS_PER_WEEK, view_azimuth=-45, view_distance=3e9, view_focalpoint=[5e2, 5e2, 5e2])
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
SECONDS_PER_YEAR
,
position
=
(
0
,
2
*
AU
,
-
11
*
AU
))
\ No newline at end of file
simulators/ursina_simulator.py
浏览文件 @
03c9e3af
...
...
@@ -20,6 +20,7 @@ from simulators.views.ursina_view import UrsinaView, UrsinaPlayer
from
simulators.ursina.ursina_config
import
UrsinaConfig
from
simulators.simulator
import
Simulator
from
common.system
import
System
from
common.func
import
find_file
import
time
import
datetime
import
math
...
...
@@ -265,7 +266,9 @@ class UrsinaSimulator(Simulator):
# cosmic_bg = '../textures/cosmic1.png'
# cosmic_bg = '../textures/cosmic2.jpg'
cosmic_bg
=
'../textures/cosmic3.jpg'
import
os
cosmic_bg
=
find_file
(
cosmic_bg
)
if
cosmic_bg
is
not
None
and
os
.
path
.
exists
(
cosmic_bg
):
self
.
cosmic_background
(
cosmic_bg
)
...
...
@@ -289,6 +292,8 @@ class UrsinaSimulator(Simulator):
else
:
bg_music
=
None
bg_music
=
find_file
(
bg_music
)
if
bg_music
is
None
:
# bg_music = "../sounds/universe_04.mp3"
bg_music
=
"../none"
...
...
simulators/views/ursina_view.py
浏览文件 @
03c9e3af
...
...
@@ -18,6 +18,7 @@ from bodies import Body
from
simulators.ursina.ursina_config
import
UrsinaConfig
from
simulators.ursina.ursina_event
import
UrsinaEvent
from
common.color_utils
import
adjust_brightness
,
conv_to_vec4_color
,
get_inverse_color
from
common.func
import
find_file
from
simulators.views.body_view
import
BodyView
from
simulators.views.ursina_mesh
import
create_sphere
,
create_torus
import
numpy
as
np
...
...
@@ -364,17 +365,21 @@ class Planet(Entity):
创建行星环(使用土星贴图)
:return:
"""
rings_texture
=
'textures/saturnRings.jpg'
rings_texture
=
find_file
(
rings_texture
)
# 行星环偏移角度
# self.ring_rotation_x = 80
# 创建行星环
# self.ring = Entity(parent=self.planet, model='circle', texture=
'../textures/saturnRings.jpg'
, scale=3.5,
# self.ring = Entity(parent=self.planet, model='circle', texture=
rings_texture
, scale=3.5,
# rotation=(self.ring_rotation_x, 0, 0), double_sided=True)
# 行星环偏移角度
self
.
ring_rotation_x
=
80
# 创建行星环
torus
=
create_torus
(
0.7
,
1.2
,
64
)
self
.
ring
=
Entity
(
parent
=
self
,
model
=
torus
,
texture
=
'../textures/saturnRings.jpg'
,
scale
=
1
,
self
.
ring
=
Entity
(
parent
=
self
,
model
=
torus
,
texture
=
rings_texture
,
scale
=
1
,
rotation
=
(
self
.
ring_rotation_x
,
0
,
0
),
double_sided
=
True
)
# 设置行星环不受灯光影响,否则看不清行星环
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录