Search code examples
geometrycgaltriangulationdelaunay

Triangulating a polygon with one hole


I'm trying to triangulate a polygon with one hole using Triangle project.

Does anyone have an example of feeding this algorithm with a polygon with a hole?


Solution

  • Here is an example of of .poly file with a hole:

    14 2 0 0
    1 1 -1
    2 1 1
    3 .25 1.25
    4 0 1
    5 -.25 1.25
    6 -1 1
    7 -1 -1
    8 -.25 -1.25
    9 0 -1
    10 .25 -1.25
    11 .33 0
    12 0 .33
    13 -.33 0
    14 0 -.33
    14 0
    1 10 1
    2 1 2
    3 2 3
    4 3 4
    5 4 5
    6 5 6
    7 6 7
    8 7 8
    9 8 9
    10 9 10
    11 11 12
    12 12 13
    13 13 14
    14 14 11
    1
    1 0.0 0.0
    

    There are three sections in the file: the polygon vertices, the polygon segments and the hole specification. The last line indicates that the point (0,0) lies in a hole in the geometry and triangles in those components will be removed by triangle.

    In showme, this .poly file looks like this:

    polygon geometry

    The small "x" in the center indicates the location specified for the hole.

    Meshing this with the command triangle simple.poly -a0.06 -q20 gives the following result:

    resulting mesh