用于在笛卡尔空间中可视化/动画粒子的 Python 框架

发布于 2024-10-04 23:13:47 字数 421 浏览 3 评论 0原文

我有表示多个时间步长的粒子位置的数据,并且需要创建一个显示这些粒子运动的动画。

是否有任何框架或工具包(最好是基于 Python 的)可以开箱即用地执行类似的操作,或者至少可以轻松快速绘制精灵/3D 对象并在多个时间步骤中对其进行动画处理?

对于第一阶段,简单的 2D 动画就足够了。不过,我希望可以选择进一步扩展它以支持 3D 和用户交互(更改视图、动画控制、将动画导出到文件等)。

只是为了澄清,我不想渲染一个复杂的场景。类似以下内容即可:

示例输出

该特定图像是类似数据集的单个帧的屏幕截图。

I have data representing the position of particles for multiple time steps and need to create an animation showing the movement of these particles.

Are there any frameworks or toolkits (ideally Python based) out there does something like this out of the box, or at least something that makes it easy to quickly plot sprites/3d-objects and animate it across multiple time steps?

For the first stage a simple 2D animation is sufficient. However I would like to have the option of extending it further to support 3D and user interaction (changing view, animation control, exporting animation to file, etc).

Just to clarify, I'm not looking to render a complicated scene. Something like the following would do:

sample output

This particular image is a screenshot of a single frame for a similar data set.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

惯饮孤独 2024-10-11 23:13:48

看看 PyODE。这将有助于物理部分。你只能靠自己来处理图形。

Have a look at PyODE. That will help with the physics part. You're on your own with the graphics.

極樂鬼 2024-10-11 23:13:47

Pyprocessing处理 Java动画库。处理开发环境包括一些非常好的实现粒子系统的示例。

Pyprocessing is a Python treatment of the processing Java animation library. The processing development environment includes some very nice examples of implementing a particle system.

小瓶盖 2024-10-11 23:13:47

Side Effects Software 的 Houdini 是一款工业级 3D 动画应用程序,具有出色的 Python 绑定、Python 表达式和一般支持。导入数据很简单,Houdini 甚至在应用程序中提供了一个用于修补的 Python shell。

导入后,您可以利用全套动画和可视化工具以及出色的捆绑渲染器“Mantra”。

有一个免费的“学徒”版本限制很少,并且有各种级别的付费许可证。

Houdini by Side Effects Software is an industry-grade 3D animation application with excellent Python bindings, Python expressions and general support. It would be simple to import your data, and Houdini even has a Python shell within the application for tinkering.

After you've imported it you can take advantage of the full range of animation and visualisation tools and the excellent bundled renderer, "Mantra".

There is a free "apprentice" edition with very few restrictions, and various levels of paid licenses.

与风相奔跑 2024-10-11 23:13:47

我们使用了 pyOGRE,它们是与 OGRE 库的 Python 绑定,其自身描述为:

什么是 OGRE? OGRE(面向对象
图形渲染引擎)是一个
面向场景的灵活3D引擎
用 C++ 编写,旨在实现它
更容易、更直观
开发人员制作应用程序
利用硬件加速 3D
图形。类库摘要
使用的所有细节
底层系统库如
Direct3D 和 OpenGL 并提供
基于世界对象的界面和
其他直观的类。

We've used pyOGRE, which are Python bindings to the OGRE library, which describes itself as:

What Is OGRE? OGRE (Object-Oriented
Graphics Rendering Engine) is a
scene-oriented, flexible 3D engine
written in C++ designed to make it
easier and more intuitive for
developers to produce applications
utilising hardware-accelerated 3D
graphics. The class library abstracts
all the details of using the
underlying system libraries like
Direct3D and OpenGL and provides an
interface based on world objects and
other intuitive classes.

白云悠悠 2024-10-11 23:13:47

在 2D 中,为什么不直接使用 matplotlib 来绘制帧的散点图从你的模拟。

例如,

import numpy as np
import matplotlib.pyplot as plt

# Just some sample data but I'm assuming that you 
# can get your data into vectors like this.
x = np.random.randn(100)
y = np.random.randn(100)

plt.figure()
plt.plot(x,y, '.')
plt.savefig('frame0000.png')

您可以从帧中制作视频。

至于 3D - 您可以尝试 matplotlibmlabmplot3D。根据我的经验,mlab 上手有点棘手。如果您需要有关使用 matplotlib 的更多帮助,请评论这篇文章。

http://www.scipy.org/Cookbook/Matplotlib /mplot3D
http://code.enthought.com/projects/mayavi /docs/development/html/mayavi/mlab.html

In 2D why don't you just use matplotlib to do scatter plots of the frames from your simulation.

For example

import numpy as np
import matplotlib.pyplot as plt

# Just some sample data but I'm assuming that you 
# can get your data into vectors like this.
x = np.random.randn(100)
y = np.random.randn(100)

plt.figure()
plt.plot(x,y, '.')
plt.savefig('frame0000.png')

You can then make a video from the frames.

As for 3D - you could try matplotlib's mlab or mplot3D. From my experience mlab is a bit trickier to get going. Comment on this post if you need more help with using matplotlib.

http://www.scipy.org/Cookbook/Matplotlib/mplot3D
http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文