Main Content

delaunayn

N-D Delaunay triangulation

Description

example

T = delaunayn(X) computes a set of simplices such that no data points of X are contained in any circumspheres of the simplices. The set of simplices forms the Delaunay triangulation. X is an m-by-n array representing m points in n-dimensional space. T is a numt-by-(n+1) array where each row contains the indices into X of the vertices of the corresponding simplex.

T = delaunayn(X,opts) specifies a cell array of Qhull options to use in computing the delaunay triangulation.

Examples

collapse all

This example generates an n-dimensional Delaunay triangulation, where n = 3.

d = [-1 1];
[x,y,z] = meshgrid(d,d,d);  % A cube
x = [x(:);0];
y = [y(:);0];
z = [z(:);0];
% [x,y,z] are corners of a cube plus the center.
X = [x(:) y(:) z(:)];
Tes = delaunayn(X)
Tes = 12×4

     4     3     9     1
     4     9     2     1
     7     9     3     1
     7     5     9     1
     7     9     4     3
     7     8     4     9
     6     2     9     1
     6     9     5     1
     6     4     9     2
     6     4     8     9
      ⋮

You can use tetramesh to visualize the tetrahedrons that form the corresponding simplex. camorbit rotates the camera position to provide a meaningful view of the figure.

tetramesh(Tes,X);
camorbit(20,0)

Figure contains an axes object. The axes object contains 12 objects of type patch.

Input Arguments

collapse all

Points, specified as a matrix. X is an m-by-n matrix representing m points in n-dimensional space.

Data Types: double

Qhull options, specified as a cell array of character vectors indicating which Qhull algorithms to use. For a list of options, see Qhull control options.

The default options are:

  • {'Qt','Qbb','Qc'} for 2- and 3-dimensional input

  • {'Qt','Qbb','Qc','Qx'} for 4 and higher-dimensional input

If opts is [], then the default options are used. If opts is an empty cell array, {''}, then no options are used, not even the defaults.

Tips

  • Plotting the output of delaunayn depends of the value of n:

    • For n = 2, use triplot, trisurf, or trimesh as you would for delaunay.

    • For n = 3, use tetramesh.

      For more control over the color of the facets, use patch to plot the output.

    • You cannot plot delaunayn output for n > 3.

Algorithms

delaunayn is based on Qhull. For more information, see http://www.qhull.org/. For copyright information, see http://www.qhull.org/COPYING.txt.

Extended Capabilities

Version History

Introduced before R2006a