Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
eea47c4a
宇宙模拟器
项目概览
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看板
提交
eea47c4a
编写于
3月 23, 2025
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
4f2d738c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
10 deletion
+63
-10
mkv_2_mp4.py
mkv_2_mp4.py
+34
-0
simulators/mpl_2d_simulator.py
simulators/mpl_2d_simulator.py
+29
-10
未找到文件。
mkv_2_mp4.py
0 → 100644
浏览文件 @
eea47c4a
import
os
import
subprocess
def
get_exists_files
(
output_dir
):
return
[
i
[:
-
2
]
+
"kv"
for
i
in
os
.
listdir
(
output_dir
)]
def
convert_mkv_to_mp4
(
input_dir
,
output_dir
):
# 确保输出目录存在
os
.
makedirs
(
output_dir
,
exist_ok
=
True
)
exists_files
=
get_exists_files
(
output_dir
)
# 遍历输入目录中的所有文件
for
filename
in
os
.
listdir
(
input_dir
):
if
filename
in
exists_files
:
continue
if
filename
.
endswith
(
'.mkv'
):
input_file
=
os
.
path
.
join
(
input_dir
,
filename
)
output_file
=
os
.
path
.
join
(
output_dir
,
filename
[:
-
4
]
+
'.mp4'
)
# 使用 ffmpeg 进行转换
command
=
[
'ffmpeg'
,
'-i'
,
input_file
,
output_file
]
subprocess
.
run
(
command
)
print
(
f
'Converted:
{
input_file
}
to
{
output_file
}
'
)
# 使用示例
input_directory
=
r
'E:\琅琊榜mkv'
# 替换为你的输入目录
output_directory
=
r
'D:\琅琊榜'
# 替换为你的输出目录
convert_mkv_to_mp4
(
input_directory
,
output_directory
)
simulators/mpl_2d_simulator.py
浏览文件 @
eea47c4a
...
...
@@ -73,17 +73,36 @@ class 星球:
self
.
轨迹
.
pop
(
0
)
# 创建星球列表
星球列表
=
[
星球
(
质量
=
1e12
,
位置
=
[
0
,
0
],
速度
=
[
0
,
1
],
颜色
=
'red'
,
名称
=
"太阳"
,
名称偏移
=
[
2
,
0
]),
星球
(
质量
=
1e9
,
位置
=
[
10
,
0
],
速度
=
[
0
,
2
],
颜色
=
'blue'
,
名称
=
"蓝星"
),
星球
(
质量
=
1e9
,
位置
=
[
-
10
,
0
],
速度
=
[
0
,
-
2
],
颜色
=
'green'
,
名称
=
"绿星"
)
]
# 初始化图形
图形
,
坐标轴
=
plt
.
subplots
()
坐标轴
.
set_xlim
(
-
50
,
50
)
坐标轴
.
set_ylim
(
-
20
,
80
)
星球列表
=
[]
def
场景1
():
global
星球列表
# 创建星球列表
星球列表
=
[
星球
(
质量
=
1e12
,
位置
=
[
0
,
0
],
速度
=
[
0
,
1
],
颜色
=
'red'
,
名称
=
"太阳"
,
名称偏移
=
[
2
,
0
]),
星球
(
质量
=
1e9
,
位置
=
[
10
,
0
],
速度
=
[
0
,
2
],
颜色
=
'blue'
,
名称
=
"蓝星"
),
星球
(
质量
=
1e9
,
位置
=
[
-
10
,
0
],
速度
=
[
0
,
-
2
],
颜色
=
'green'
,
名称
=
"绿星"
)
]
坐标轴
.
set_xlim
(
-
50
,
50
)
坐标轴
.
set_ylim
(
-
20
,
80
)
def
场景2
():
global
星球列表
星球列表
=
[
星球
(
质量
=
1e12
,
位置
=
[
10
,
0
],
速度
=
[
0
,
1
],
颜色
=
'blue'
,
名称
=
"蓝星"
,
名称偏移
=
[
2
,
0
]),
星球
(
质量
=
1e12
,
位置
=
[
-
10
,
0
],
速度
=
[
0
,
-
1
],
颜色
=
'green'
,
名称
=
"绿星"
,
名称偏移
=
[
2
,
0
])
]
坐标轴
.
set_xlim
(
-
50
,
50
)
坐标轴
.
set_ylim
(
-
50
,
50
)
# 场景1()
场景2
()
# 调整边距
plt
.
subplots_adjust
(
left
=
0.05
,
bottom
=
0.04
,
right
=
0.97
,
top
=
0.97
,
wspace
=
0.4
,
hspace
=
0.4
)
点列表
=
[
坐标轴
.
plot
([],
[],
'o'
,
color
=
星球
.
颜色
,
markersize
=
星球
.
大小
)[
0
]
for
星球
in
星球列表
]
...
...
@@ -129,4 +148,4 @@ def 更新(帧):
动画
=
FuncAnimation
(
图形
,
更新
,
frames
=
range
(
1000
),
init_func
=
初始化
,
blit
=
True
,
interval
=
2
)
# 显示动画
plt
.
show
()
\ No newline at end of file
plt
.
show
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录