tetgen

TetGen generates tets for empty chambers/holes in a model


I am using tetgen to generate meshes for my research.

My models have empty internal chambers inside them. For example, an empty box of size (5,5,5) inside a box of size (10, 10, 10). See image:Box chamber within a bigger box

The problem is that tetgen generates tetrahedrons inside the empty chamber. Why? Is there a way to avoid it?

I tried using -YY, -q, -CC, -c, and their combinations, but all had the same problem, and did not give insight on the error. (http://wias-berlin.de/software/tetgen/1.5/doc/manual/manual005.html).


Solution

  • The way I solved it was to create a .poly file (http://wias-berlin.de/software/tetgen/fformats.poly.html). I created a .poly file from a .off file (https://en.wikipedia.org/wiki/OFF_(file_format)), which I could export from OpenScad.

    .poly file has 4 parts, from which the 3rd specifies holes in the object. You need to tell TetGen where you have holes in the object. The way to do it, is by specifying one point in the hole/chamber.

    A possible .poly file would look like this:

    part1 - vertices:

    40 3 0 0
    0 0.2 0 1 
    1 0.161803 0.117557 0 
    ...
    

    part2 - faces:

    72 0
    1
    3 0 1 2
    1
    3 1 0 3
    ...
    

    part3 - holes <============== the one I needed

    1
    1 0 0 0.5   <=== this is a point, which I know is inside my hole/chamber
    



    So here is the file, without any breaks, just in case:

    40 3 0 0
    0 0.2 0 1 
    1 0.161803 0.117557 0 
    ...
    
    72 0
    1
    3 0 1 2
    1
    3 1 0 3
    ...
    
    1
    1 0 0 0.5