matlabpolyhedra

How do I break a polyhedron into tetrahedra in MATLAB?


I have a polyhedron, with a list of vertices (v) and surfaces (s). How do I break this polyhedron into a series of tetrahedra?

I would particularly like to know if there are any built-in MATLAB commands for this.


Solution

  • I would suggest trying the built-in function DELAUNAY3. The example given in the documentation link resembles Aaron's answer in that it uses the vertices plus the center point of the polyhedron to create a 3-D Delaunay tessellation, but shabbychef points out that you can still create a tessellation without including the extra point. You can then use TETRAMESH to visualize the resulting tetrahedral elements.

    Your code might look something like this (assuming v is an N-by-3 matrix of vertex coordinate values):

    v = [v; mean(v)];  %# Add an additional center point, if desired (this code
                       %#   adds the mean of the vertices)
    Tes = delaunay3(v(:,1),v(:,2),v(:,3));  %# Create the triangulation
    tetramesh(Tes,v);                       %# Plot the tetrahedrons
    

    Since you said in a comment that your polyhedron is convex, you shouldn't have to worry about specifying the surfaces as constraints in order to do the triangulation (shabbychef appears to give a more rigorous and terse proof of this than my comments below do).

    NOTE: According to the documentation, DELAUNAY3 will be removed in a future release and DelaunayTri will effectively take its place (although currently it appears that defining constrained edges is still limited to only 2-D triangulations). For the sake of completeness, here is how you would use DelaunayTri and visualize the convex hull (i.e. polyhedral surface) as well:

    DT = DelaunayTri(v);  %# Using the same variable v as above
    tetramesh(DT);        %# Plot the tetrahedrons
    figure;               %# Make new figure window
    ch = convexHull(DT);  %# Get the convex hull
    trisurf(ch,v(:,1),v(:,2),v(:,3),'FaceColor','cyan');  %# Plot the convex hull