View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

5.0 | 1 rating Rate this file 14 Downloads (last 30 days) File Size: 39.7 KB File ID: #27830 Version: 1.2
image thumbnail



Dirk-Jan Kroon (view profile)


04 Jun 2010 (Updated )

Convert a closed triangulated mesh to a tetrahedron volume ( like constrained Delaunay )

| Watch this File

File Information

 This function MESH2TETRA converts a triangulated surface mesh into a tetrahedron volume mesh.
  Main advantage above existing constrained 3D Delaunay is that it
  will never add new boundary points, (useful for active appearance models)
  Disadvantage, some highly non-convex surface-shapes cannot be converted.
    V : Vertex List N x 3, with x,y,z positions
    F : Face List M x 3, with vertex indices
    options : Struct with options
    options.verbose : if true, show information
    options.checkinput : if true, check input mesh on errors
    T : Tetrahedron List K x 4, with tetrahedron indices
  Note!, most functions are also available as c-code (much faster),
    run compile_c_files.m to compile the code
  How the software works:
  - First, normal Delaunay is used to created a tetrahedron convexhull.
    Then outside tetrahedrons and tetrahedrons intersecting the boundary
    mesh are removed.
  - Second, New triangulated surface meshes are constructed for the space
    not yet filled by tetrahedrons. After which Delaunay
    is done on the new boundary meshes.
  - Third, The remaining boundary which cannot be filled using Delaunay
    constraints, is filled with a "Boundary collapse method". The Boundary
    collapse method merges vertex neighbors, creating tetrahedrons while
    making the surface mesh smaller (like a deflating balloon)
  - Fourth, It is possible that a part of the boundary mesh is left over which
    cannot be filled with tetrahedrons. This is the case if there are no 4
    vertices left who can see each other (like a non-convex polygon). In
    that case nearby Tetrahedrons are removed creating a new boundary
    mesh. And tetrahedron fitting with the boundary collapse methods is
    tried again (until success, or a fixed amount of tries).

Please leave a comment if you find a bug, like the code, or have a good suggestion.

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
27 Nov 2011 YE HUICHAO

Sorry I don't know how to use this file.I just open the examples and run the m.file but Matlab shows error. What should I do to practice it on a real mesh?

Comment only
17 Sep 2011 linreal Lin

17 Sep 2011 linreal Lin

The codes work on R2009a after some minor modification. However, the computation time is too long for only 300 faces. Only part of the C codes can be MEXed, so hopefully the complete C MEX version can be released soon. Thanks a lot for the nice work!

Comment only
07 Jun 2010 1.1

Improved help and made input-options work for sub-functions.

18 Jun 2010 1.2

Added some code to correct for mesh intersections, sadly not yet perfect ...

Contact us