从数据生成几何对象的视频或图像

发布于 2024-08-31 04:05:03 字数 214 浏览 11 评论 0原文

我正在参与一个课程项目,以预测太阳系行星(和其他物体)的速度和位置。如果我可以可视化预测的对象数据,如果可以生成 3D 图像,如果在视频中那真是太棒了,那真是太酷了。 您知道有什么库可以让我使用这些数据生成图像或视频吗? (我不在乎用哪种语言)

数据:
- 模拟步骤(视频的时间线步骤)
- 物体的位置
- 物体的半径和/或颜色

提前致谢,欢迎任何建议。

I'm working in a course's project to predict the velocity and position of the solar system planets (and other objects). It will be really cool if I can visualize the predicted objects data, if it's possible generating 3D images, if in video that's amazing.
Do you know any library that lets me to use this data to generate an image or video? (I don't care in which language)

Data:
- simulation step (time line step for a video)
- positions of the objects
- radius and/or colours of the objects

Thanks in advance, any suggestion is welcome.

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

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

发布评论

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

评论(2

罪歌 2024-09-07 04:05:03

对于这种类型的可视化,我使用了多种方法(全部通过 Python):

VPython 非常容易学习后,您将能够在几分钟内获得围绕太阳旋转的行星的动态 3D 可视化。也有一些有助于制作电影的贡献,但我没有使用过这些。

人们还可以直接使用 OpenGL,例如在 wxPython 窗口中通过 PyOpenGL,或者使用例如,PyGlet。这种方法比 VPython 更基础,可能需要更长的时间,我知道制作电影的唯一方法是通过屏幕截图等。

VTK 是一个非常令人印象深刻的 3D 可视化库,但更难学习。 VTK 与其他软件一样,将进行开箱即用的动态可视化,并且它是唯一具有用于制作图像和电影的内置模块的软件。不过,它是一个复杂得多的库,但如果您想要行星围绕恒星旋转,并在矢量场离子风暴中绘制气体云的等高线图,VTK 可以做到。还有 MayaVi,它使 VTK 更易于访问和交互。

There are several approaches that I've used (all via Python) for this type of visualization:

VPython is super easy to learn and you'll be able to get dynamic 3D visualization of planets spinning around a sun in minutes. There are contributions to help make movies as well, but I haven't used these.

One can also just use OpenGL directly, via, say, PyOpenGL within a wxPython window, or, using, for example, PyGlet. This approach is a bit more basic than VPython and will probably take longer to do, and the only way I know to make movies is via screenshots, etc.

VTK is an very impressive 3D visualization library, but is much harder to learn. VTK, like the others, will do dynamic visualization out-of-the-box, and it's the only one that has a built-in module for making images and movies. It is, though, a much more complicated library, but if you want planets spinning around a star, with a contour plot of a gas cloud, in the midst of a vector-field ion-storm, VTK can do it. There's also MayaVi which makes VTK a bit more accessible and interactive.

日裸衫吸 2024-09-07 04:05:03

我有一个非常粗略的想法,可能作为一个有用的起点,尽管它需要相当多的充实才能看起来适当专业。您的数据是否给出了给定时间点每个行星在太空中的位置?如果是这样,您可以:

1) 如果位置数据最初是 3-D,则将其投影到双空间中(允许您使用 2-D 方法来表示看起来仍然像在屏幕上以 3-D 显示的数据)

2)结果应该是一系列存储行星位置的二维矩阵。如果矩阵元素对应于行星的位置,则令它们为1,否则令它们为0。 (如果要绘制矩阵,它看起来就像黑色背景上的一些白点。)

3)使用形态膨胀来获取每个位置点并将其邻居的值设置为 1 而不是 0,因此当你绘图时,你会得到一组以步骤(2)中的点为中心的圆盘状白色物体。

4)使用程序将(3)中的每个矩阵写入图像文件,并将它们放在公共文件夹中。

5) 在运行时,使用另一个程序从文件夹中一次导入每个图像,并将它们显示在屏幕上的同一个图形窗口中。结果应该是代表时间 t 的行星的每个图像都替换了时间 (t-1) 的图像。这在视觉上看起来应该与在该窗口中播放视频文件相同。

最终的结果将是在黑色背景下在轨道上呈现一堆白色圆圈的动态图像。那会有用吗?

I have a very rough idea that might be useful as a starting point, although it would need quite a bit of fleshing out in order to look properly professional. Does your data give the position of each planet in space at a given point in time? If so, you could:

1) Project your position data into twospace if it was originally 3-D (allowing you to use 2-D methods to represent data that still looks like it's being displayed in 3-D on the screen)

2) The result should be a series of 2-D matrices storing the locations of your planets. Let the matrix elements be 1 if they correspond to the location of a planet, and let them be 0 otherwise. (If you were to plot the matrix, it would look like a handful of white dots on a black background.)

3) Use the use morphological dilation to take every position point and set the values of their neighbors to 1 instead of 0, so that when you plot you get a set of disc-shaped white objects centered on the points from step (2).

4) Use a program to write each matrix from (3) to an image file, and put them in a common folder.

5) At runtime, use another program to import each image from the folder one at a time, displaying them on the screen in the same figure window. The result should be that each image representing the planets at time t replaces the picture for time (t-1). This should look optically the same as if a video file were playing in that window.

The end result would be a moving-picture show of a bunch of white circles in orbit against a black background. Would that be useful?

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