views:

202

answers:

3

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.

+3  A: 

For the convex case (no dents in the surface which cause surfaces to cover each other) and a triangle mesh, the simple solution is to calculate the center of the polyhedron and then connect the three corners of every face with the new center.

If you don't have a triangle mesh, then you must triangulate, first. Delaunay triangulation might help.

If there are holes or caves, this can be come arbitrarily complex.

Aaron Digulla
***the simple solution is to calculate the center***-- which center you are referring to?
Ngu Soon Hui
Any point strictly inside the convex polyhedron works. You could use the center of the bounding box of the polyhedron.
Andreas Brinck
Good solution, and I upvoted it. I would have accepted it if there was a matlab builtin command in your answer. :)
Ngu Soon Hui
Delaunay trinagulation is fortunately available as MATLAB builtins in the function "delaunay"
kigurai
@Ngu Soon Hui: I don't have access to matlab :)
Aaron Digulla
+2  A: 

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
gnovice
*Since you said in a comment that your polyhedron is convex, I don't think you have to worry about specifying the surfaces as constraints*-- thanks for your comment; is there any proof for this particular statement?
Ngu Soon Hui
Quoted from Wikipedia (http://en.wikipedia.org/wiki/Polyhedron): "A polyhedron is said to be convex if its surface (comprising its faces, edges and vertices) does not intersect itself and the line segment joining any two points of the polyhedron is contained in the interior or surface." In such a case, the tetrahedrons created with the above triangulation should all also lie inside the polyhedron. If you had a "pocket" in the polyhedron (concave), the above triangulation would likely create one or more tetrahedral elements to fill this pocket, thus creating elements outside the polyhedron.
gnovice
...to put it another way, I believe the surface of a convex polyhedron should match the convex hull generated from its vertices. Since the above triangulation builds tetrahedrons using the convex hull, the outer surface of the tetrahedral mesh should match the surface of the polyhedron. Hence, you shouldn't have to worry about constraining the triangulation to recreate the outer surfaces of the polyhedron, since it should do this by default.
gnovice
+3  A: 

I'm not sure the OP wanted a 'mesh' (Steiner points added) or a tetrahedralization (partition into tetrahedra, no Steiner points added). for a convex polyhedron, the addition of Steiner points (e.g. the 'center' point) is not necessary.

Stack overflow will not allow me to comment on gnovice's post (WTF, SO?), but the proof of the statement "the surfaces of a convex polyhedron are constraints in a Delaunay Tesselation" is rather simple: by definition, a simplex or subsimplex is a member in the Delaunay Tesselation if and only if there is a n-sphere circumscribing the simplex that strictly contains no point in the point set. for a surface triangle, construct the smallest circumscribing sphere, and 'puff' it outwards, away from the polyhedron, towards 'infinity'; eventually it will contain no other point. (in fact, the limit of the circumscribing sphere is a half-space; thus the convex hull is always a subset of the Delaunay Tesselation.)

for more on DT, see Okabe, et. al, 'Spatial Tesselations', or any of the papers by Shewchuk

(my thesis was on this stuff, but I remember less of it than I should...)

shabbychef
Unfortunately, SO requires that you have 50 Rep to leave comments on questions or answers that aren't your own. There has been some debate on Meta about this (http://meta.stackoverflow.com/questions/12119/lower-the-amount-of-reputation-needed-to-comment), but I'm not sure it will lead to any changes.
gnovice
**for a convex polyhedron, the addition of Steiner points (e.g. the 'center' point) is not necessary** -- you have proof for this? I tried to generate the Tetrahedron in this way ( by taking all the vertices of the polyhedron, without taking the center point) in Matlab, and operation failed.
Ngu Soon Hui
the proof is somewhat complicated; if we define the Delaunay Triangulation as the dual of the Voronoi Diagram, then trivially it exists; whether it is a proper triangulation (or in 3D, a tetrahedralization), is a more difficult proposition. I would see Okabe et. al. for this. Also, the DT may not be unique, unless the point set is in general position: having multiple cospherical points (like a Platonic solid) can confound or break some software; robustness is another concern. A lot of work in the field concerns robust computation of geometric predicates. see e.g. Shewchuk's work. HTH,
shabbychef

related questions