Next: , Up: Delaunay Triangulation


30.1.1 Plotting the Triangulation

Octave has the functions triplot, trimesh, and trisurf to plot the Delaunay triangulation of a 2-dimensional set of points. tetramesh will plot the triangulation of a 3-dimensional set of points.

— Function File: triplot (tri, x, y)
— Function File: triplot (tri, x, y, linespec)
— Function File: h = triplot (...)

Plot a triangular mesh in 2D. The variable tri is the triangular meshing of the points (x, y) which is returned from delaunay. If given, linespec determines the properties to use for the lines.

The optional return value h is a graphics handle to the created plot.

See also: plot, trimesh, trisurf, delaunay.

— Function File: trimesh (tri, x, y, z)
— Function File: h = trimesh (...)

Plot a triangular mesh in 3D. The variable tri is the triangular meshing of the points (x, y) which is returned from delaunay. The variable z is value at the point (x, y).

The optional return value h is a graphics handle to the created plot.

See also: triplot, trisurf, delaunay3.

— Function File: trisurf (tri, x, y, z)
— Function File: h = trisurf (...)

Plot a triangular surface in 3D. The variable tri is the triangular meshing of the points (x, y) which is returned from delaunay. The variable z is value at the point (x, y).

The optional return value h is a graphics handle to the created plot.

See also: triplot, trimesh, delaunay3.

— Function File: tetramesh (T, X)
— Function File: tetramesh (T, X, C)
— Function File: tetramesh (..., property, val, ...)
— Function File: h = tetramesh (...)

Display the tetrahedrons defined in the m-by-4 matrix T as 3-D patches. T is typically the output of a Delaunay triangulation of a 3-D set of points. Every row of T contains four indices into the n-by-3 matrix X of the vertices of a tetrahedron. Every row in X represents one point in 3-D space.

The vector C specifies the color of each tetrahedron as an index into the current colormap. The default value is 1:m where m is the number of tetrahedrons; the indices are scaled to map to the full range of the colormap. If there are more tetrahedrons than colors in the colormap then the values in C are cyclically repeated.

Calling tetramesh (..., "property", "value", ...) passes all property/value pairs directly to the patch function as additional arguments.

The optional return value h is a vector of patch handles where each handle represents one tetrahedron in the order given by T. A typical use case for h is to turn the respective patch "visible" property "on" or "off".

Type demo tetramesh to see examples on using tetramesh.

See also: delaunay3, delaunayn, trimesh, patch.

The difference between triplot, and trimesh or triplot, is that the former only plots the 2-dimensional triangulation itself, whereas the second two plot the value of a function f (x, y). An example of the use of the triplot function is

     rand ("state", 2)
     x = rand (20, 1);
     y = rand (20, 1);
     tri = delaunay (x, y);
     triplot (tri, x, y);

which plots the Delaunay triangulation of a set of random points in 2-dimensions. The output of the above can be seen in fig:triplot.

triplot.png

Figure 30.2: Delaunay triangulation of a random set of points