Search code examples
matlabtriangulation

matlab: triangulate point set


Given a point set (i.e a 3XN array of vertices), how can I triangulate it using matlab? Assuming the point set does represent some surface of an object, and does not contain any noise.


EDIT: The chosen answer gives a way to create the tetrahedrons of a mesh. I was looking for triangulation; for my specific case of a convex shape, the convex hull (using convhulln as suggested in the answer's comments) was enough.


Solution

  • To create a Delaunay triangulation, you can use the class DELAUNAYTRI:

    You create a triangulation object by calling

    DT = DelaunayTri(coordinates);
    

    where coordinates is a N-by-3 (or 2) array of vertex coordinates.

    To access the triangulation, call

    tri = DT.triangulation;
    

    To plot, call e.g.

    patch('Vertices',DT.X,'Faces',DT.triangulation)