Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
7849c22e
宇宙模拟器
项目概览
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看板
提交
7849c22e
编写于
10月 27, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
2a23da04
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
63 addition
and
10 deletion
+63
-10
objs/textures/two_way_foil_circle.png
objs/textures/two_way_foil_circle.png
+0
-0
sim_scenes/tri_bodies/two_way_foil.py
sim_scenes/tri_bodies/two_way_foil.py
+9
-9
sim_scenes/tri_bodies/two_way_foil_02.py
sim_scenes/tri_bodies/two_way_foil_02.py
+9
-0
sim_scenes/tri_bodies/two_way_foil_03.py
sim_scenes/tri_bodies/two_way_foil_03.py
+10
-1
sim_scenes/tri_bodies/two_way_foil_04.py
sim_scenes/tri_bodies/two_way_foil_04.py
+10
-0
simulators/func.py
simulators/func.py
+25
-0
未找到文件。
objs/textures/two_way_foil_circle.png
查看替换文件 @
2a23da04
浏览文件 @
7849c22e
471.8 KB
|
W:
|
H:
23.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
sim_scenes/tri_bodies/two_way_foil.py
浏览文件 @
7849c22e
...
...
@@ -17,6 +17,7 @@ from objs import QuadObj, CircleObj, Obj
from
sim_scenes.func
import
camera_look_at
,
two_bodies_colliding
from
sim_scenes.func
import
ursina_run
,
create_sphere_sky
from
simulators.ursina.ursina_event
import
UrsinaEvent
from
simulators.func
import
ext_fun_for_method
class
TwoWayFoilSim
:
...
...
@@ -45,15 +46,6 @@ class TwoWayFoilSim:
# endregion
init_bodies_pos_vels
(
self
.
bodies
)
# # 获取模拟的初始位置和速度
# init_pos_vels = get_init_pos_vels()
#
# for body in self.bodies:
# pos_vels = init_pos_vels.get(type(body).__name__.lower(), None)
# if pos_vels is None:
# continue
# body.init_position = pos_vels['pos']
# body.init_velocity = pos_vels['vel']
def
build_two_way_foil
(
self
):
"""
...
...
@@ -94,6 +86,14 @@ class TwoWayFoilSim:
self
.
two_way_foil_circle
.
planet
.
rotation_x
=
90
self
.
two_way_foil_circle
.
planet
.
enabled
=
False
def
change_two_way_foil
():
# 长方形膜状物,长八点五厘米,宽五点二厘米,比一张信用卡略大一些,极薄,看不出任何厚度。
# 封装状态下晶莹剔透、无色透明。待机模式下由于封装力场逐渐蒸发,会发出白光,使其表面呈纯白色,看上去就是一张纸条
self
.
two_way_foil
.
planet
.
scale_x
=
8.5
self
.
two_way_foil
.
planet
.
scale_y
=
5.2
ext_fun_for_method
(
self
.
two_way_foil
.
planet
,
after_run_fun
=
change_two_way_foil
)
def
flatten_animation
(
self
,
body
):
"""
天体二维化的动画
...
...
sim_scenes/tri_bodies/two_way_foil_02.py
浏览文件 @
7849c22e
...
...
@@ -17,6 +17,7 @@ from objs import QuadObj, CircleObj, Obj
from
sim_scenes.func
import
camera_look_at
,
two_bodies_colliding
from
sim_scenes.func
import
ursina_run
,
create_sphere_sky
from
simulators.ursina.ursina_event
import
UrsinaEvent
from
simulators.func
import
ext_fun_for_method
class
TwoWayFoilSim
:
...
...
@@ -94,6 +95,14 @@ class TwoWayFoilSim:
self
.
two_way_foil_circle
.
planet
.
rotation_x
=
90
self
.
two_way_foil_circle
.
planet
.
enabled
=
False
def
change_two_way_foil
():
# 长方形膜状物,长八点五厘米,宽五点二厘米,比一张信用卡略大一些,极薄,看不出任何厚度。
# 封装状态下晶莹剔透、无色透明。待机模式下由于封装力场逐渐蒸发,会发出白光,使其表面呈纯白色,看上去就是一张纸条
self
.
two_way_foil
.
planet
.
scale_x
=
8.5
self
.
two_way_foil
.
planet
.
scale_y
=
5.2
ext_fun_for_method
(
self
.
two_way_foil
.
planet
,
after_run_fun
=
change_two_way_foil
)
def
flatten_animation
(
self
,
body
):
"""
天体二维化的动画
...
...
sim_scenes/tri_bodies/two_way_foil_03.py
浏览文件 @
7849c22e
...
...
@@ -18,6 +18,7 @@ from objs import QuadObj, CircleObj, Obj
from
sim_scenes.func
import
camera_look_at
,
two_bodies_colliding
from
sim_scenes.func
import
ursina_run
,
create_sphere_sky
from
simulators.ursina.ursina_event
import
UrsinaEvent
from
simulators.func
import
ext_fun_for_method
class
TwoWayFoilSim
:
...
...
@@ -86,6 +87,14 @@ class TwoWayFoilSim:
self
.
two_way_foil_circle
.
planet
.
rotation_x
=
90
self
.
two_way_foil_circle
.
planet
.
enabled
=
False
def
change_two_way_foil
():
# 长方形膜状物,长八点五厘米,宽五点二厘米,比一张信用卡略大一些,极薄,看不出任何厚度。
# 封装状态下晶莹剔透、无色透明。待机模式下由于封装力场逐渐蒸发,会发出白光,使其表面呈纯白色,看上去就是一张纸条
self
.
two_way_foil
.
planet
.
scale_x
=
8.5
self
.
two_way_foil
.
planet
.
scale_y
=
5.2
ext_fun_for_method
(
self
.
two_way_foil
.
planet
,
after_run_fun
=
change_two_way_foil
)
def
gen_pixcel_image
(
self
,
planet
):
"""
将纹理图改为像素图片
...
...
@@ -165,7 +174,7 @@ class TwoWayFoilSim:
self
.
two_way_foil
.
planet
.
enabled
=
False
self
.
two_way_foil
.
init_velocity
=
[
0
,
0
,
0
]
# 圆形二向箔显示并设置透明度为0.9
self
.
two_way_foil_circle
.
planet
.
alpha
=
0.
9
self
.
two_way_foil_circle
.
planet
.
alpha
=
0.
8
self
.
two_way_foil_circle
.
planet
.
enabled
=
True
# 当前阶段为 stage_02:二向箔压平天体的阶段
self
.
current_stage
=
self
.
stage_02
...
...
sim_scenes/tri_bodies/two_way_foil_04.py
浏览文件 @
7849c22e
...
...
@@ -17,6 +17,7 @@ from objs import QuadObj, CircleObj, Obj
from
sim_scenes.func
import
camera_look_at
,
two_bodies_colliding
from
sim_scenes.func
import
ursina_run
,
create_sphere_sky
from
simulators.ursina.ursina_event
import
UrsinaEvent
from
simulators.func
import
ext_fun_for_method
class
TwoWayFoilSim
:
...
...
@@ -94,6 +95,14 @@ class TwoWayFoilSim:
self
.
two_way_foil_circle
.
planet
.
rotation_x
=
90
self
.
two_way_foil_circle
.
planet
.
enabled
=
False
def
change_two_way_foil
():
# 长方形膜状物,长八点五厘米,宽五点二厘米,比一张信用卡略大一些,极薄,看不出任何厚度。
# 封装状态下晶莹剔透、无色透明。待机模式下由于封装力场逐渐蒸发,会发出白光,使其表面呈纯白色,看上去就是一张纸条
self
.
two_way_foil
.
planet
.
scale_x
=
8.5
self
.
two_way_foil
.
planet
.
scale_y
=
5.2
ext_fun_for_method
(
self
.
two_way_foil
.
planet
,
after_run_fun
=
change_two_way_foil
)
def
flatten_animation
(
self
,
body
):
"""
天体二维化的动画
...
...
@@ -194,6 +203,7 @@ class TwoWayFoilSim:
if
self
.
two_way_foil
.
planet
.
enabled
:
self
.
two_way_foil
.
planet
.
rotation_x
+=
0.2
self
.
two_way_foil
.
planet
.
rotation_y
+=
2
# 摄像机始终看向二向箔
camera_look_at
(
self
.
two_way_foil
)
self
.
current_stage
()
...
...
simulators/func.py
浏览文件 @
7849c22e
...
...
@@ -138,3 +138,28 @@ def update_ax_styles(ax, styles={}):
ax
.
set_xlabel
(
'X(天文单位:AU)'
,
fontsize
=
"18"
,
color
=
fore_color
)
ax
.
set_ylabel
(
'Y(天文单位:AU)'
,
fontsize
=
"18"
,
color
=
fore_color
)
ax
.
set_zlabel
(
'Z(天文单位:AU)'
,
fontsize
=
"18"
,
color
=
fore_color
)
def
ext_fun_for_method
(
obj
,
method_name
=
'update'
,
before_run_fun
=
None
,
after_run_fun
=
None
):
"""
对方法进行扩展
@param obj:
@param method_name:
@param before_run_fun:
@param after_run_fun:
@return:
"""
if
before_run_fun
is
None
and
after_run_fun
is
None
:
return
obj
.
original_method
=
getattr
(
obj
,
method_name
)
def
new_method
():
def
warp
():
if
callable
(
before_run_fun
):
before_run_fun
()
obj
.
original_method
()
if
callable
(
after_run_fun
):
after_run_fun
()
return
warp
()
setattr
(
obj
,
method_name
,
new_method
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录