从三角形网格和平面的相交创建轮廓
我在创建轮廓时遇到问题。
我有一个STL文件,STL文件包含许多面,通过将面与切割平面相交(Z=dz,x=y=0)
,我们在每个增量Z处都有一个线数组。
但是线条不按顺序排列。我想对它们进行排序并连接以形成闭合轮廓或连续路径。请帮我提供一个程序或代码来解决这个问题。
i have problem with creating contour.
I have an STL file, the STL file includes many facets,by intersecting facets with cutting plane(Z=dz,x=y=0)
, we have an array of lines at each incremental Z.
However lines are not in order.I want to sort and connect them to form closed contour or continuous path. Please help me with a program or code to solve this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Rock 和 Wozny (1) 提出的用于创建轮廓的 Marching 算法来实现这一点。这个想法非常简单,您将从一个面行进到一个相邻面,确定它们公共边缘的交点,然后继续前往下一个相邻面。您将重复此操作,直到到达起始面。这样你就可以构建封闭的轮廓。对于每个高度标记访问的边缘,以防其上有更多轮廓。
行进算法,来源:(1)
为了使算法工作,您需要有网格的拓扑信息。每个
面必须引用其三个相邻面和三个边。每条边都必须参考
它的两个顶点和定义该边 (1) 的两个面。请参阅 (2) 了解如何从 STL 文件获取该信息。
来源:
(1) 利用拓扑信息提高扫描矢量生成效率; Rock和Wozny(行进算法)
(2) 从“Bucket of Facets”生成拓扑信息; Rock 和 Wozny,1992(如何从 STL 文件创建拓扑)
You can do that with the Marching algorithm for contour creation, presented by Rock and Wozny (1). The idea is quite simple, you will be marching from a face to a neighbour face, determine the intersection at their common edge and proceed to the next neighbour. You will repeat this until you get to the starting face. That way you will be building closed contours. For each height flag visited edges in case there is more contours at it.
Marching algorithm, source: (1)
For the algorithm to work, you need to have topological information of the mesh. Each
face must reference its three neighboring faces and three edges. Each edge must reference
its two vertices and the two faces which define that edge (1). See (2) for how to get that information from an STL file.
Sources:
(1) Utilizing Topological Information to Increase Scan Vector Generation Efficiency; Rock and Wozny (the marching algorithm)
(2) Generating Topological Information from a "Bucket of Facets"; Rock and Wozny, 1992 (how to create topology from a STL file)