Navigation

Operators and Keywords

Function List:

C++ API

: tri = delaunay (x, y)
: tetr = delaunay (x, y, z)
: tri = delaunay (x)
: tri = delaunay (…, options)

Compute the Delaunay triangulation for a 2-D or 3-D set of points.

For 2-D sets, the return value tri is a set of triangles which satisfies the Delaunay circum-circle criterion, i.e., only a single data point from [x, y] is within the circum-circle of the defining triangle. The set of triangles tri is a matrix of size [n, 3]. Each row defines a triangle and the three columns are the three vertices of the triangle. The value of tri(i,j) is an index into x and y for the location of the j-th vertex of the i-th triangle.

For 3-D sets, the return value tetr is a set of tetrahedrons which satisfies the Delaunay circum-circle criterion, i.e., only a single data point from [x, y, z] is within the circum-circle of the defining tetrahedron. The set of tetrahedrons is a matrix of size [n, 4]. Each row defines a tetrahedron and the four columns are the four vertices of the tetrahedron. The value of tetr(i,j) is an index into x, y, z for the location of the j-th vertex of the i-th tetrahedron.

The input x may also be a matrix with two or three columns where the first column contains x-data, the second y-data, and the optional third column contains z-data.

The optional last argument, which must be a string or cell array of strings, contains options passed to the underlying qhull command. See the documentation for the Qhull library for details http://www.qhull.org/html/qh-quick.htm#options. The default options are {"Qt", "Qbb", "Qc", "Qz"}.

If options is not present or [] then the default arguments are used. Otherwise, options replaces the default argument list. To append user options to the defaults it is necessary to repeat the default arguments in options. Use a null string to pass no arguments.

x = rand (1, 10);
y = rand (1, 10);
tri = delaunay (x, y);
triplot (tri, x, y);
hold on;
plot (x, y, "r*");
axis ([0,1,0,1]);

See also: delaunayn, convhull, voronoi, triplot, trimesh, tetramesh, trisurf.

Demonstration 1

The following code

 old_state = rand ("state");
 restore_state = onCleanup (@() rand ("state", old_state));
 rand ("state", 1);
 x = rand (1,10);
 y = rand (1,10);
 tri = delaunay (x,y);
 clf;
 triplot (tri, x, y);
 hold on;
 plot (x, y, "r*");
 axis ([0,1,0,1]);

Produces the following figure

Figure 1

Package: octave