Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
70b52784
宇宙模拟器
项目概览
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看板
提交
70b52784
编写于
12月 19, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
abaf8cf2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
19 deletion
+35
-19
sim_scenes/featured/look_at_sky_on_earth.py
sim_scenes/featured/look_at_sky_on_earth.py
+32
-16
sim_scenes/featured/look_at_sky_on_earth_e.py
sim_scenes/featured/look_at_sky_on_earth_e.py
+1
-1
sim_scenes/featured/look_at_sky_on_earth_n.py
sim_scenes/featured/look_at_sky_on_earth_n.py
+1
-1
sim_scenes/featured/look_at_sky_on_earth_s.py
sim_scenes/featured/look_at_sky_on_earth_s.py
+1
-1
未找到文件。
sim_scenes/featured/look_at_sky_on_earth.py
浏览文件 @
70b52784
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
# link :https://gitcode.net/pythoncr/
# link :https://gitcode.net/pythoncr/
# python_version :3.9
# python_version :3.9
# ==============================================================================
# ==============================================================================
import
math
from
ursina
import
camera
from
ursina
import
camera
from
bodies
import
Sun
,
Earth
from
bodies
import
Sun
,
Earth
...
@@ -40,6 +42,7 @@ class LookAtSkyOnEarth(UniverseSimScenes):
...
@@ -40,6 +42,7 @@ class LookAtSkyOnEarth(UniverseSimScenes):
self
.
show_china
=
show_china
self
.
show_china
=
show_china
self
.
show_name
=
show_name
self
.
show_name
=
show_name
self
.
exit_at_total_days
=
exit_at_total_days
self
.
exit_at_total_days
=
exit_at_total_days
self
.
angle
=
55
earth_transparent
=
look_point
is
not
None
earth_transparent
=
look_point
is
not
None
...
@@ -63,6 +66,7 @@ class LookAtSkyOnEarth(UniverseSimScenes):
...
@@ -63,6 +66,7 @@ class LookAtSkyOnEarth(UniverseSimScenes):
earth_cn_size_factor
=
earth_cn_size_factor
,
earth_cn_size_factor
=
earth_cn_size_factor
,
earth_clouds_size_factor
=
earth_clouds_size_factor
)
earth_clouds_size_factor
=
earth_clouds_size_factor
)
self
.
earth
.
set_resolution
(
200
)
self
.
earth
.
set_resolution
(
200
)
self
.
earth
.
set_light_disable
(
True
)
# # 地球立春的位置和速度
# # 地球立春的位置和速度
# self.earth.init_position = [-9.1507536e+07, 0.0000000e+00, 1.1907757e+08]
# self.earth.init_position = [-9.1507536e+07, 0.0000000e+00, 1.1907757e+08]
...
@@ -96,26 +100,38 @@ class LookAtSkyOnEarth(UniverseSimScenes):
...
@@ -96,26 +100,38 @@ class LookAtSkyOnEarth(UniverseSimScenes):
from
simulators.ursina.ursina_mesh
import
create_sphere
from
simulators.ursina.ursina_mesh
import
create_sphere
from
ursina
import
Entity
,
color
from
ursina
import
Entity
,
color
r
=
0.5
r
=
0.5
y
=
0.4
scale
=
0.05
x
=
-
0.26
# subdivisions = 16
watcher_e
=
Entity
(
parent
=
self
.
earth
.
planet
,
x_y_angle
=
math
.
pi
*
self
.
angle
/
180
model
=
create_sphere
(
r
,
32
),
xr
=
r
*
math
.
cos
(
x_y_angle
)
scale
=
0.05
,
y
=
r
*
math
.
sin
(
x_y_angle
)
y
=
0.0
,
x
=
x
-
0.17
,
z
=
pow
(
pow
(
r
,
2
)
-
pow
(
x
-
0.17
,
2
),
0.5
),
color
=
color
.
green
)
# z = pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5)
x_z_angle
=
math
.
pi
*
45
/
180
x
=
r
*
math
.
cos
(
x_z_angle
)
z
=
r
*
math
.
sin
(
x_z_angle
)
watcher_e
=
Entity
(
parent
=
self
.
earth
.
planet
,
model
=
"sphere"
,
# create_sphere(r, subdivisions),
scale
=
scale
,
y
=
0.0
,
x
=-
x
,
z
=
z
,
color
=
color
.
red
)
# y=0.0, x=x-0.17, z=pow(pow(r, 2) - pow(x-0.17, 2), 0.5), color=color.green)
x
=
xr
*
math
.
cos
(
x_z_angle
)
z
=
xr
*
math
.
sin
(
x_z_angle
)
watcher_n
=
Entity
(
parent
=
self
.
earth
.
planet
,
watcher_n
=
Entity
(
parent
=
self
.
earth
.
planet
,
model
=
create_sphere
(
r
,
32
),
model
=
"sphere"
,
# create_sphere(r, subdivisions),
scale
=
0.05
,
scale
=
scale
,
y
=
y
,
x
=
x
,
z
=
pow
(
pow
(
r
,
2
)
-
pow
(
x
,
2
)
-
pow
(
y
,
2
),
0.5
),
color
=
color
.
red
)
y
=
y
,
x
=-
x
,
z
=
z
,
color
=
color
.
green
)
# y=y, x=x, z=pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5), color=color.red)
watcher_s
=
Entity
(
parent
=
self
.
earth
.
planet
,
watcher_s
=
Entity
(
parent
=
self
.
earth
.
planet
,
model
=
create_sphere
(
r
,
32
),
model
=
"sphere"
,
# create_sphere(r, subdivisions),
scale
=
0.05
,
scale
=
scale
,
y
=-
y
,
x
=
x
,
z
=
pow
(
pow
(
r
,
2
)
-
pow
(
x
,
2
)
-
pow
(
y
,
2
),
0.5
),
color
=
color
.
blue
)
y
=-
y
,
x
=-
x
,
z
=
z
,
color
=
color
.
blue
)
# y=-y, x=x, z=pow(pow(r, 2) - pow(x, 2) - pow(y, 2), 0.5), color=color.blue)
def
on_ready
(
self
):
def
on_ready
(
self
):
self
.
earth
.
planet
.
rotation_y
-=
180
# 一开始就正对太阳
self
.
earth
.
planet
.
rotation_y
-=
180
# 一开始就正对太阳
# self.earth.planet.alpha = 0.2
self
.
earth
.
planet
.
alpha
=
0.8
# self.earth_cn.planet.rotation_y -= 185 # 一开始就正对太阳
# self.earth_cn.planet.rotation_y -= 185 # 一开始就正对太阳
if
hasattr
(
self
.
earth_clouds
,
"planet"
):
if
hasattr
(
self
.
earth_clouds
,
"planet"
):
self
.
earth_clouds
.
planet
.
rotation_y
-=
50
# 一开始就正对太阳
self
.
earth_clouds
.
planet
.
rotation_y
-=
50
# 一开始就正对太阳
...
@@ -175,7 +191,7 @@ class LookAtSkyOnEarth(UniverseSimScenes):
...
@@ -175,7 +191,7 @@ class LookAtSkyOnEarth(UniverseSimScenes):
# if self.look_point == 1:
# if self.look_point == 1:
if
self
.
look_point
is
not
None
:
if
self
.
look_point
is
not
None
:
camera
.
rotation_x
=
50
*
self
.
look_point
camera
.
rotation_x
=
self
.
angle
*
self
.
look_point
# camera.rotation_x = 50 # 1 南半球
# camera.rotation_x = 50 # 1 南半球
# if self.look_at_earth:
# if self.look_at_earth:
if
self
.
look_point
is
None
:
if
self
.
look_point
is
None
:
...
@@ -209,7 +225,7 @@ class LookAtSkyOnEarth(UniverseSimScenes):
...
@@ -209,7 +225,7 @@ class LookAtSkyOnEarth(UniverseSimScenes):
self
.
create_sky_watchers
()
self
.
create_sky_watchers
()
def
on_timer_changed
(
self
,
time_data
:
TimeData
):
def
on_timer_changed
(
self
,
time_data
:
TimeData
):
if
abs
(
self
.
earth
.
planet
.
init_rotation_y
-
self
.
earth
.
planet
.
rotation_y
)
>
3
65
:
if
abs
(
self
.
earth
.
planet
.
init_rotation_y
-
self
.
earth
.
planet
.
rotation_y
)
>
3
80
:
exit
(
0
)
exit
(
0
)
# if self.show_china and self.wait_days_count > 0:
# if self.show_china and self.wait_days_count > 0:
# self.wait_days_count = self.wait_days - time_data.total_days
# self.wait_days_count = self.wait_days - time_data.total_days
...
@@ -261,4 +277,4 @@ if __name__ == '__main__':
...
@@ -261,4 +277,4 @@ if __name__ == '__main__':
"""
"""
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
sim
=
LookAtSkyOnEarth
()
sim
=
LookAtSkyOnEarth
()
sim
.
run
()
sim
.
run
(
speed_factor
=
0.9
)
sim_scenes/featured/look_at_sky_on_earth_e.py
浏览文件 @
70b52784
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
"""
"""
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
sim
=
LookAtSkyOnEarth
(
look_point
=
0
)
sim
=
LookAtSkyOnEarth
(
look_point
=
0
)
sim
.
run
()
sim
.
run
(
speed_factor
=
0.85
)
sim_scenes/featured/look_at_sky_on_earth_n.py
浏览文件 @
70b52784
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
"""
"""
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
sim
=
LookAtSkyOnEarth
(
look_point
=-
1
)
sim
=
LookAtSkyOnEarth
(
look_point
=-
1
)
sim
.
run
()
sim
.
run
(
speed_factor
=
0.85
)
sim_scenes/featured/look_at_sky_on_earth_s.py
浏览文件 @
70b52784
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
...
@@ -15,4 +15,4 @@ if __name__ == '__main__':
"""
"""
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
# -1:北半球 Northern Hemisphere, 1:南半球 Southern Hemisphere, 0:赤道 Equator
sim
=
LookAtSkyOnEarth
(
look_point
=
1
)
sim
=
LookAtSkyOnEarth
(
look_point
=
1
)
sim
.
run
()
sim
.
run
(
speed_factor
=
0.85
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录