如何栅格化 3D 网格?
我有一个 3d 网格(一组三角形),它定义了一个封闭的水密表面。我想栅格化这个网格,即将网格占用的空间划分为均匀的小立方体(2d 像素的 3d 等效项),并将三角形穿过的立方体绘制为黑色,其余的绘制为白色。例如,类似于将 2D 矢量图形图像光栅化为光栅化 BMP 的方式。 换句话说,我想输出一个 3d 数组 A
,即 M x M x M
,这样 A(i,j,k)
如果存在某个三角形穿过立方体在位置i,j,k
处占据的空间,则code>为1。 希望这是清楚的,如果没有 - 告诉我,我会澄清。
任何算法、库、matlab 例程都可以。
I have a 3d mesh (a set of triangles) that defines a closed watertight surface. I want to rasterize this mesh, that is divide the space occupied by the mesh to even, little cubes (the 3d equivalent of 2d pixels), and paint the cubes that a triangle passes through as black and the rest as white. Similar to how one would rasterize a 2d vector-graphic image into a rasterized bmp, for instance.
In other words, I want to output a 3d array, A
that is M x M x M
, such that A(i,j,k)
is 1 if there is some triangle which passes through the space occupied by the cube at the location i,j,k
.
Hope that was clear, if not - tell me and I'll clarify.
Any algorithm, library, matlab routine will do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法向您展示一些算法或库,但可以提供一个小提示。您要查找的术语是体素化。尝试谷歌,它可能会为您提供一些这方面的资源,以及这个小但也很旧的主题简介,这可能是进一步研究的基础。
I cannot present you some algorithm or library, but a small hint. The term you are looking for is Voxelization. Try google and it may present you some ressources on this, along with this small but also quite old introduction to the topic which might be a foundation for further research.
我发现这个体素分析器非常适合我的需求。它运行速度相当快,并且还有一个 matlab 脚本,用于将生成的体素文件读入 matlab。
I've found this voxelizer quite fitting for my needs. It works quite fast, and also has a matlab script for reading the resulting voxel file into matlab.