triangulate.md 2 KB
Newer Older
Hui Wang's avatar
Hui Wang committed
1
[[Home]](/docs/index.md) [[Mesh Edit]](/docs/meshedit/overview.md) [[Path Tracer]](/docs/pathtracer/overview.md) [[Animation]](/docs/animation/overview.md)
Hui Wang's avatar
Hui Wang committed
2

TheNumbat's avatar
TheNumbat committed
3
---
Hui Wang's avatar
Hui Wang committed
4

TheNumbat's avatar
TheNumbat committed
5
6
7

# Triangulation

Hui Wang's avatar
Hui Wang committed
8
For an in-practice example, see the [User Guide](/docs/guide/model.md).
TheNumbat's avatar
TheNumbat committed
9

allai5's avatar
allai5 committed
10
A variety of geometry processing algorithms become easier to implement (or are only well defined) when the input consists purely of triangles. The method `Halfedge_Mesh::triangulate` converts any polygon mesh into a triangle mesh by splitting each polygon into triangles.
TheNumbat's avatar
TheNumbat committed
11
12
13
14
15

This transformation is performed in-place, i.e., the original mesh data is replaced with the new, triangulated data (rather than making a copy). The implementation of this method will look much like the implementation of the local mesh operations, with the addition of looping over every face in the mesh.

There is more than one way to split a polygon into triangles. Two common patterns are to connect every vertex to a single vertex, or to "zig-zag" the triangulation across the polygon:

Hui Wang's avatar
Hui Wang committed
16
<center><img src="global/triangulate/triangulate.png" style="height:300px"></center>
TheNumbat's avatar
TheNumbat committed
17
18
19
20
21
22
23
24
25

The `triangulate` routine is not required to produce any particular triangulation so long as:

*   all polygons in the output are triangles,
*   the vertex positions remain unchanged, and
*   the output is a valid, manifold halfedge mesh.

Note that triangulation of nonconvex or nonplanar polygons may lead to geometry that is unattractive or difficult to interpret. However, the purpose of this method is simply to produce triangular _connectivity_ for a given polygon mesh, and correct halfedge connectivity is the only invariant that must be preserved by the implementation. The _geometric_ quality of the triangulation can later be improved by running other global algorithms (e.g., isotropic remeshing); ambitious developers may also wish to consult the following reference:

allai5's avatar
allai5 committed
26
*   Zou et al, ["An Algorithm for Triangulating Multiple 3D Polygons"](http://www.cs.wustl.edu/~taoju/research/triangulate_final.pdf)