Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
83777627
宇宙模拟器
项目概览
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看板
提交
83777627
编写于
11月 28, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
30b8ddd2
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
532 addition
and
12 deletion
+532
-12
sim_lab/halley_comet_research_calc.py
sim_lab/halley_comet_research_calc.py
+3
-3
sim_scenes/featured/earth_3d.py
sim_scenes/featured/earth_3d.py
+10
-3
sim_scenes/featured/wormhole_sim.py
sim_scenes/featured/wormhole_sim.py
+500
-0
sim_scenes/func.py
sim_scenes/func.py
+8
-2
simulators/ursina/entities/body_timer.py
simulators/ursina/entities/body_timer.py
+3
-2
simulators/ursina/entities/camera3d.py
simulators/ursina/entities/camera3d.py
+8
-2
未找到文件。
sim_lab/halley_comet_research_calc.py
浏览文件 @
83777627
...
...
@@ -136,8 +136,8 @@ def calc_simulator(params, factor=1):
def
before_evolve
(
dt
,
context
:
CalcContext
):
sim
.
start_time
=
conv_to_astropy_time
(
params
.
start_time
)
# td = TimeData(sim.total_times * dt, BodyTimer.MIN_UNIT_SECONDS)
time_data
=
TimeData
(
sim
.
total_times
*
dt
,
BodyTimer
.
MIN_UNIT_SECONDS
)
# td = TimeData(sim.total_times * dt, BodyTimer.MIN_UNIT_SECONDS
, dt
)
time_data
=
TimeData
(
sim
.
total_times
*
dt
,
BodyTimer
.
MIN_UNIT_SECONDS
,
dt
)
sim
.
total_times
+=
1
t
=
sim
.
start_time
+
time_data
.
total_days
...
...
@@ -157,7 +157,7 @@ def calc_simulator(params, factor=1):
d_sun
=
calculate_distance
(
sim
.
halley_comet
.
position
,
sim
.
sun
.
position
)
d_earth
=
calculate_distance
(
sim
.
halley_comet
.
position
,
sim
.
earth
.
position
)
time_data
=
context
.
get_param
(
"time_data"
)
# td = TimeData(sim.total_times * dt * UrsinaSimulator.INTERVAL_FATOR, BodyTimer.MIN_UNIT_SECONDS)
# td = TimeData(sim.total_times * dt * UrsinaSimulator.INTERVAL_FATOR, BodyTimer.MIN_UNIT_SECONDS
, dt
)
# sim.set_bodies_position(td)
...
...
sim_scenes/featured/earth_3d.py
浏览文件 @
83777627
...
...
@@ -43,7 +43,7 @@ if __name__ == '__main__':
def
on_ready
():
# 运行前触发
create_sphere_sky
(
scale
=
200
0
)
sky
=
create_sphere_sky
(
scale
=
10000
,
rotation_y
=
15
0
)
def
on_timer_changed
(
time_data
):
...
...
@@ -52,6 +52,13 @@ if __name__ == '__main__':
# 地球转了一圈(360)就停止,370是留些余量
if
abs
(
earth
.
planet
.
rotation_y
)
>
365
:
exit
(
0
)
# from ursina import camera, Vec3, time
# camera.parent.position += Vec3(0.0000001 * time_data.dt, 0, -0.0000003 * time_data.dt)
# Camera3d.look_to(earth.planet)
# camera.parent.look_at(earth.planet)
# # camera.rotation_x = 0
# # camera.rotation_y = 0
# camera.rotation_z = 0
UniverseSimScenes
.
set_window_size
((
1920
,
1079
),
False
)
...
...
@@ -63,8 +70,8 @@ if __name__ == '__main__':
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run
(
bodies
,
# SECONDS_PER_HOUR / 2
,
SECONDS_PER_HOUR
,
SECONDS_PER_HOUR
/
5
,
#
SECONDS_PER_HOUR,
position
=
(
1.45
*
earth
.
radius
,
0
,
-
30000
),
cosmic_bg
=
""
,
# 无背景(黑色)
show_grid
=
False
,
# 不显示网格
...
...
sim_scenes/featured/wormhole_sim.py
0 → 100644
浏览文件 @
83777627
此差异已折叠。
点击以展开。
sim_scenes/func.py
浏览文件 @
83777627
...
...
@@ -367,7 +367,7 @@ def create_light_ship(size_scale, init_position, speed=LIGHT_SPEED):
init_velocity
=
[
0
,
0
,
speed
]).
set_light_disable
(
True
)
def
create_3d_card
(
left
=-
.
885
,
top
=
0.495
,
width
=
0.0
2
,
height
=
0.02
):
def
create_3d_card
(
left
=-
.
885
,
top
=
0.495
,
width
=
0.0
1
,
height
=
0.01
):
# 创建一个 Panel 组件
from
ursina
import
Text
,
Panel
,
color
,
camera
,
Vec3
from
simulators.ursina.ursina_config
import
UrsinaConfig
...
...
@@ -707,13 +707,19 @@ def speed_smooth_adjust_test():
plt
.
show
()
def
create_sphere_sky
(
texture
=
"bg_pan.jpg"
,
scale
=
8000
):
def
create_sphere_sky
(
texture
=
"bg_pan.jpg"
,
scale
=
8000
,
rotation_x
=
None
,
rotation_y
=
None
,
rotation_z
=
None
):
from
common.image_utils
import
find_texture
from
simulators.ursina.entities.sphere_sky
import
SphereSky
sky_texture
=
find_texture
(
texture
,
None
)
if
sky_texture
is
not
None
:
sky
=
SphereSky
(
texture
=
sky_texture
)
sky
.
scale
=
scale
if
rotation_x
is
not
None
:
sky
.
rotation_x
=
rotation_x
if
rotation_y
is
not
None
:
sky
.
rotation_y
=
rotation_y
if
rotation_z
is
not
None
:
sky
.
rotation_z
=
rotation_z
return
sky
else
:
print
(
f
'`textures`目录下没有找到图片`
{
texture
}
`,请访问如下链接下载,下载后,将图片放在`textures`目录下'
)
...
...
simulators/ursina/entities/body_timer.py
浏览文件 @
83777627
...
...
@@ -17,7 +17,7 @@ from simulators.ursina.ursina_event import UrsinaEvent
class
TimeData
:
def
__init__
(
self
,
seconds
,
min_unit
):
def
__init__
(
self
,
seconds
,
min_unit
,
dt
):
from
ursina
import
time
if
not
hasattr
(
TimeData
,
"app_start_time"
):
setattr
(
TimeData
,
"app_start_time"
,
time
.
time
())
...
...
@@ -32,6 +32,7 @@ class TimeData:
days
,
hours
=
divmod
(
hours
,
24
)
years
=
days
//
365
days
=
days
%
365
self
.
dt
=
dt
self
.
years
=
int
(
years
)
self
.
days
=
int
(
days
)
...
...
@@ -196,7 +197,7 @@ class BodyTimer(Singleton):
# time_text = f'{int(hours):02d}:{int(minutes):02d}:{int(seconds):02d}'
# print(self.text)
UrsinaEvent
.
on_timer_changed
(
TimeData
(
seconds
,
self
.
min_unit
))
UrsinaEvent
.
on_timer_changed
(
TimeData
(
seconds
,
self
.
min_unit
,
dt
))
def
ignore_gravity
(
self
,
body
):
return
True
...
...
simulators/ursina/entities/camera3d.py
浏览文件 @
83777627
...
...
@@ -37,15 +37,21 @@ class Camera3d(Entity):
def
switch_position
(
self
):
if
self
.
camera_pos
==
"right"
:
# 摄像机右眼
self
.
x
-=
2
*
self
.
eye_distance
# self.x -= 2 * self.eye_distance
self
.
position
+=
self
.
left
*
2
*
self
.
eye_distance
self
.
camera_pos
=
"left"
elif
self
.
camera_pos
==
"left"
:
# 摄像机左眼
self
.
x
+=
2
*
self
.
eye_distance
# self.x += 2 * self.eye_distance
self
.
position
+=
self
.
right
*
2
*
self
.
eye_distance
self
.
camera_pos
=
"right"
def
update
(
self
):
pass
@
staticmethod
def
look_to
(
target
,
axis
=
'forward'
):
Camera3d
.
o
.
camera3d
.
look_at
(
target
,
axis
)
@
staticmethod
def
init
(
eye_distance
=
None
,
init_pos
=
None
):
Camera3d
.
is_ready
=
True
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录