Suppose you have a 3 dimensional object, represented as a 3d mesh in some common file format. How would you devise an algorithm to decompose the mesh into one or more 2d 'nets' - that is, a 2-dimensional representation that can be cut out and folded to create the original 3d object.
假设您有一个3维对象,以某种常见文件格式表示为3d网格。您将如何设计一种算法将网格分解为一个或多个2d'网' - 即,可以剪切和折叠以创建原始3d对象的二维表示。
Amongst other things, the algorithm would need to account for:
除此之外,该算法还需要考虑:
- Multiple possible decompositions for any given object
- Handling fitting a mesh into fixed size canvases (sheets of paper).
- Recognizing when two panels in the net would overlap (and are thus invalid).
- Breaking a mesh up into multiple nets if they can't be represented as a single one, due to overlap or page size constraints.
- Generating tabs in the appropriate places, for attaching adjacent faces.
对任何给定对象进行多种可能的分解
处理将网格装配到固定尺寸的画布(纸张)。
识别网中的两个面板何时重叠(因此无效)。
由于重叠或页面大小限制,如果网格无法表示为单个网格,则将网格分成多个网络。
在适当的位置生成制表符,用于附加相邻的面。
The obvious degenerate case is simply to create one net per face, with tabs on half the edges. This isn't ideal, obviously: The ideal case is a single continuous net. The reality for complex shapes is likely to be somewhere in the middle.
明显的退化情况就是每面创造一个网,边缘有一半。这显然不是理想的:理想的情况是单个连续网。复杂形状的现实很可能在中间。
I realize that finding the optimal net (fewest nets / least pages) is probably computationally expensive, but a good heuristic for finding 'good enough' nets would suffice.
我意识到找到最佳网络(最少网络/最少页面)可能在计算上很昂贵,但是找到“足够好”网络的良好启发式就足够了。
3 个解决方案
#1
When I read your question, the words "automatic papercraft algorithm" came to me. So I googled it and found Papercraft Models using Generalized Cylinders (pdf) by Massarwi et al.
当我读到你的问题时,“自动书写算法”这个词出现在我面前。所以我用谷歌搜索它,并使用Massarwi等人使用广义圆柱(pdf)找到Papercraft模型。
We propose a new method for producing unfolded papercraft patterns of rounded toy animal figures from triangulated meshes by means of strip-based approximation. Although in principle a triangulated model can be unfolded simply by retaining as much as possible of its connectivity while checking for intersecting triangles in the unfolded plane, creating a pattern with tens of thousands of triangles is unrealistic. Our approach is to approximate the mesh model by a set of continuous triangle strips with no internal vertices. Initially, we subdivide our mesh into parts corresponding to the features of the model. We segment each part into zonal regions, grouping triangles which are similar topological distances from the part boundary. We generate triangle strips by simplifying the mesh while retaining the borders of the zonal regions and additional cut-lines. The pattern is then created simply by unfolding the set of strips. The distinguishing feature of our method is that we approximate a mesh model by a set of continuous strips, not by other ruled surfaces such as parts of cones or cylinders. Thus, the approximated unfolded pattern can be generated using only mesh operations and a simple unfolding algorithm. Furthermore, a set of strips can be crafted just by bending the paper (without breaking edges) and can represent smooth features of the original mesh models.
我们提出了一种新方法,通过基于条带的近似,从三角网格中生成圆形玩具动物图形的展开纸制图案。虽然原则上可以简单地通过在检查展开平面中的交叉三角形的同时保持其连通性来展开三角模型,但是创建具有数万个三角形的图案是不现实的。我们的方法是通过一组没有内部顶点的连续三角形条来近似网格模型。最初,我们将网格细分为与模型特征相对应的部分。我们将每个部分分割成区域区域,将与区域边界相似的拓扑距离的三角形分组。我们通过简化网格生成三角形条带,同时保留区域区域和其他切割线的边界。然后简单地通过展开条带组来创建图案。我们的方法的显着特征是我们通过一组连续条带来近似网格模型,而不是通过其他规则表面(例如锥体或圆柱体的部分)来近似网格模型。因此,可以仅使用网格操作和简单的展开算法来生成近似展开的图案。此外,可以通过弯曲纸张(不破坏边缘)来制作一组条带,并且可以表示原始网格模型的平滑特征。
There is also an earlier related paper called Paper craft models from meshes (9MB pdf) by Shatz et al.
还有一篇早期的相关论文,称为Shatz等人的网格纸工艺模型(9MB pdf)。
This paper introduces an algorithm for segmenting a mesh into developable approximations. The algorithm can be used in various applications in CAD and computer graphics. This paper focuses on paper crafting and demonstrates that the algorithm generates approximations that are developable, easy to cut, and can be glued together. It is also shown that the error between the given model and the paper model is small.
本文介绍了一种将网格划分为可展开近似的算法。该算法可用于CAD和计算机图形学中的各种应用。本文重点介绍纸张制作,并演示该算法可生成可开发,易于切割且可粘合在一起的近似值。还表明给定模型和纸模型之间的误差很小。
Source: http://www.ee.technion.ac.il/~ayellet/images/sel-papers-pic-5.jpg
#2
The algorithms eed3si9n linked to will generate nice reasonable papercraft meshes from complicated geometry. If you'd like to unfold the mesh exactly as it is modeled, such as for polyhedra models, then here's a relatively simple technique for unfolding any mesh as it stand
链接到的eed3si9n算法将从复杂的几何体中生成合理的合理的纸制网格。如果您想完全按照建模的方式展开网格,例如对于多面体模型,那么这是一种相对简单的技术,用于展开任何网格
Construct a graph from your source mesh where each face is a vertex in the graph, and two vertices are connected if they share a common edge in the mesh. One of these graphs represents an unfoldable mesh if and only if it has no loops, i.e. it is a tree.
从源网格构造图形,其中每个面都是图形中的顶点,如果它们在网格*享公共边,则连接两个顶点。这些图中的一个表示不可展开的网格,当且仅当它没有环时,即它是树。
A good tree represents the fewest fold lines to get to the farthest face from the starting point, since each fold represents error that will accumulate in the finished model. Dijkstra's algorithm is good here, but minimum spanning tree doesn't work. With each edge equally weighted all trees are minimum spanning trees, even one that would unfold your mesh into one big spiral. As you glued the model together, errors would build up until the last few faces didn't fit at all.
一棵好树代表从起点到达最远面的最少折叠线,因为每个折叠代表将在完成的模型中累积的误差。 Dijkstra的算法在这里很好,但最小生成树不起作用。每条边均衡加权,所有树都是最小的生成树,甚至可以将网格展开成一个大螺旋。当你将模型粘在一起时,错误会累积,直到最后几个面完全不适合。
Once you have the tree, start by drawing your starting face at the origin. Then walk the tree and add the new faces by calculating the new vertex as the intersection of two circles with radii corresponding to the lengths of the edges in the original mesh. Locations for tabs correspond to edges that were in the original mesh, but are not in the flattenable tree.
拥有树后,首先在原点绘制起始面。然后走树并通过计算新顶点作为两个圆的交点来添加新面,其中半径对应于原始网格中边的长度。选项卡的位置对应于原始网格中的边,但不在可展平树中。
User-specified cuts can be handled as edge deletions before the tree step.
用户指定的剪切可以在树步骤之前作为边删除处理。
Some downsides of this technique are that it will happily create overlapping parts in the flat pattern, and it is dependent on finding a good starting face. I tried Floyd-Warshal to find a minimum-diameter face to start from, but its O(n^3) behavior made for excessively long coffee breaks. The overlapping parts could be dealt with by marking that branch of the tree as "incomplete", skipping it, and re-running the algorithm on all incomplete faces again.
这种技术的一些缺点是它会在平面图案中愉快地创建重叠部分,并且它取决于找到一个好的起始面。我试过Floyd-Warshal找到一个最小直径的脸开始,但它的O(n ^ 3)行为造成了过长的咖啡休息时间。可以通过将树的分支标记为“不完整”,跳过它并再次在所有不完整的面上重新运行算法来处理重叠部分。
#3
I know this is not an answer, but it is related. Ex-SGI graphics guy Paul Haeberli's Lamina program is a solution for this problem.
我知道这不是一个答案,但它是相关的。 Ex-SGI图形人员Paul Haeberli的Lamina计划是解决这个问题的方法。
#1
When I read your question, the words "automatic papercraft algorithm" came to me. So I googled it and found Papercraft Models using Generalized Cylinders (pdf) by Massarwi et al.
当我读到你的问题时,“自动书写算法”这个词出现在我面前。所以我用谷歌搜索它,并使用Massarwi等人使用广义圆柱(pdf)找到Papercraft模型。
We propose a new method for producing unfolded papercraft patterns of rounded toy animal figures from triangulated meshes by means of strip-based approximation. Although in principle a triangulated model can be unfolded simply by retaining as much as possible of its connectivity while checking for intersecting triangles in the unfolded plane, creating a pattern with tens of thousands of triangles is unrealistic. Our approach is to approximate the mesh model by a set of continuous triangle strips with no internal vertices. Initially, we subdivide our mesh into parts corresponding to the features of the model. We segment each part into zonal regions, grouping triangles which are similar topological distances from the part boundary. We generate triangle strips by simplifying the mesh while retaining the borders of the zonal regions and additional cut-lines. The pattern is then created simply by unfolding the set of strips. The distinguishing feature of our method is that we approximate a mesh model by a set of continuous strips, not by other ruled surfaces such as parts of cones or cylinders. Thus, the approximated unfolded pattern can be generated using only mesh operations and a simple unfolding algorithm. Furthermore, a set of strips can be crafted just by bending the paper (without breaking edges) and can represent smooth features of the original mesh models.
我们提出了一种新方法,通过基于条带的近似,从三角网格中生成圆形玩具动物图形的展开纸制图案。虽然原则上可以简单地通过在检查展开平面中的交叉三角形的同时保持其连通性来展开三角模型,但是创建具有数万个三角形的图案是不现实的。我们的方法是通过一组没有内部顶点的连续三角形条来近似网格模型。最初,我们将网格细分为与模型特征相对应的部分。我们将每个部分分割成区域区域,将与区域边界相似的拓扑距离的三角形分组。我们通过简化网格生成三角形条带,同时保留区域区域和其他切割线的边界。然后简单地通过展开条带组来创建图案。我们的方法的显着特征是我们通过一组连续条带来近似网格模型,而不是通过其他规则表面(例如锥体或圆柱体的部分)来近似网格模型。因此,可以仅使用网格操作和简单的展开算法来生成近似展开的图案。此外,可以通过弯曲纸张(不破坏边缘)来制作一组条带,并且可以表示原始网格模型的平滑特征。
There is also an earlier related paper called Paper craft models from meshes (9MB pdf) by Shatz et al.
还有一篇早期的相关论文,称为Shatz等人的网格纸工艺模型(9MB pdf)。
This paper introduces an algorithm for segmenting a mesh into developable approximations. The algorithm can be used in various applications in CAD and computer graphics. This paper focuses on paper crafting and demonstrates that the algorithm generates approximations that are developable, easy to cut, and can be glued together. It is also shown that the error between the given model and the paper model is small.
本文介绍了一种将网格划分为可展开近似的算法。该算法可用于CAD和计算机图形学中的各种应用。本文重点介绍纸张制作,并演示该算法可生成可开发,易于切割且可粘合在一起的近似值。还表明给定模型和纸模型之间的误差很小。
Source: http://www.ee.technion.ac.il/~ayellet/images/sel-papers-pic-5.jpg
#2
The algorithms eed3si9n linked to will generate nice reasonable papercraft meshes from complicated geometry. If you'd like to unfold the mesh exactly as it is modeled, such as for polyhedra models, then here's a relatively simple technique for unfolding any mesh as it stand
链接到的eed3si9n算法将从复杂的几何体中生成合理的合理的纸制网格。如果您想完全按照建模的方式展开网格,例如对于多面体模型,那么这是一种相对简单的技术,用于展开任何网格
Construct a graph from your source mesh where each face is a vertex in the graph, and two vertices are connected if they share a common edge in the mesh. One of these graphs represents an unfoldable mesh if and only if it has no loops, i.e. it is a tree.
从源网格构造图形,其中每个面都是图形中的顶点,如果它们在网格*享公共边,则连接两个顶点。这些图中的一个表示不可展开的网格,当且仅当它没有环时,即它是树。
A good tree represents the fewest fold lines to get to the farthest face from the starting point, since each fold represents error that will accumulate in the finished model. Dijkstra's algorithm is good here, but minimum spanning tree doesn't work. With each edge equally weighted all trees are minimum spanning trees, even one that would unfold your mesh into one big spiral. As you glued the model together, errors would build up until the last few faces didn't fit at all.
一棵好树代表从起点到达最远面的最少折叠线,因为每个折叠代表将在完成的模型中累积的误差。 Dijkstra的算法在这里很好,但最小生成树不起作用。每条边均衡加权,所有树都是最小的生成树,甚至可以将网格展开成一个大螺旋。当你将模型粘在一起时,错误会累积,直到最后几个面完全不适合。
Once you have the tree, start by drawing your starting face at the origin. Then walk the tree and add the new faces by calculating the new vertex as the intersection of two circles with radii corresponding to the lengths of the edges in the original mesh. Locations for tabs correspond to edges that were in the original mesh, but are not in the flattenable tree.
拥有树后,首先在原点绘制起始面。然后走树并通过计算新顶点作为两个圆的交点来添加新面,其中半径对应于原始网格中边的长度。选项卡的位置对应于原始网格中的边,但不在可展平树中。
User-specified cuts can be handled as edge deletions before the tree step.
用户指定的剪切可以在树步骤之前作为边删除处理。
Some downsides of this technique are that it will happily create overlapping parts in the flat pattern, and it is dependent on finding a good starting face. I tried Floyd-Warshal to find a minimum-diameter face to start from, but its O(n^3) behavior made for excessively long coffee breaks. The overlapping parts could be dealt with by marking that branch of the tree as "incomplete", skipping it, and re-running the algorithm on all incomplete faces again.
这种技术的一些缺点是它会在平面图案中愉快地创建重叠部分,并且它取决于找到一个好的起始面。我试过Floyd-Warshal找到一个最小直径的脸开始,但它的O(n ^ 3)行为造成了过长的咖啡休息时间。可以通过将树的分支标记为“不完整”,跳过它并再次在所有不完整的面上重新运行算法来处理重叠部分。
#3
I know this is not an answer, but it is related. Ex-SGI graphics guy Paul Haeberli's Lamina program is a solution for this problem.
我知道这不是一个答案,但它是相关的。 Ex-SGI图形人员Paul Haeberli的Lamina计划是解决这个问题的方法。