octave: Plotting the 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.
-- : triplot (TRI, X, Y)
-- : triplot (TRI, X, Y, LINESPEC)
-- : H = triplot (...)
Plot a 2-D triangular mesh.
TRI is typically the output of a Delaunay triangulation over the
grid of X, Y. Every row of TRI represents one triangle and
contains three indices into [X, Y] which are the vertices of the
triangles in the x-y plane.
The linestyle to use for the plot can be defined with the argument
LINESPEC of the same format as the ‘plot’ command.
The optional return value H is a graphics handle to the created
patch object.
DONTPRINTYET See also: plot XREFplot, trimesh XREFtrimesh, *noteDONTPRINTYET See also: plot XREFplot, trimesh XREFtrimesh,
trisurf XREFtrisurf, delaunay XREFdelaunay.
-- : trimesh (TRI, X, Y, Z, C)
-- : trimesh (TRI, X, Y, Z)
-- : trimesh (TRI, X, Y)
-- : trimesh (..., PROP, VAL, ...)
-- : H = trimesh (...)
Plot a 3-D triangular wireframe mesh.
In contrast to ‘mesh’, which plots a mesh using rectangles,
‘trimesh’ plots the mesh using triangles.
TRI is typically the output of a Delaunay triangulation over the
grid of X, Y. Every row of TRI represents one triangle and
contains three indices into [X, Y] which are the vertices of the
triangles in the x-y plane. Z determines the height above the
plane of each vertex. If no Z input is given then the triangles
are plotted as a 2-D figure.
The color of the trimesh is computed by linearly scaling the Z
values to fit the range of the current colormap. Use ‘caxis’
and/or change the colormap to control the appearance.
Optionally, the color of the mesh can be specified independently of
Z by supplying C, which is a vector for colormap data, or a matrix
with three columns for RGB data. The number of colors specified in
C must either equal the number of vertices in Z or the number of
triangles in TRI.
Any property/value pairs are passed directly to the underlying
patch object.
The optional return value H is a graphics handle to the created
patch object.
See also: mesh XREFmesh, tetramesh XREFtetramesh,
DONTPRINTYET triplot XREFtriplot, trisurf XREFtrisurf, *noteDONTPRINTYET DONTPRINTYET triplot XREFtriplot, trisurf XREFtrisurf,
delaunay XREFdelaunay, patch XREFpatch, *notehidden:
DONTPRINTYET DONTPRINTYET triplot XREFtriplot, trisurf XREFtrisurf,
delaunay XREFdelaunay, patch XREFpatch, hidden
XREFhidden.
-- : trisurf (TRI, X, Y, Z, C)
-- : trisurf (TRI, X, Y, Z)
-- : trisurf (..., PROP, VAL, ...)
-- : H = trisurf (...)
Plot a 3-D triangular surface.
In contrast to ‘surf’, which plots a surface mesh using rectangles,
‘trisurf’ plots the mesh using triangles.
TRI is typically the output of a Delaunay triangulation over the
grid of X, Y. Every row of TRI represents one triangle and
contains three indices into [X, Y] which are the vertices of the
triangles in the x-y plane. Z determines the height above the
plane of each vertex.
The color of the trisurf is computed by linearly scaling the Z
values to fit the range of the current colormap. Use ‘caxis’
and/or change the colormap to control the appearance.
Optionally, the color of the mesh can be specified independently of
Z by supplying C, which is a vector for colormap data, or a matrix
with three columns for RGB data. The number of colors specified in
C must either equal the number of vertices in Z or the number of
triangles in TRI. When specifying the color at each vertex the
triangle will be colored according to the color of the first vertex
only (see patch documentation and the "FaceColor" property when set
to "flat").
Any property/value pairs are passed directly to the underlying
patch object.
The optional return value H is a graphics handle to the created
patch object.
DONTPRINTYET See also: surf XREFsurf, triplot XREFtriplot, *noteDONTPRINTYET DONTPRINTYET See also: surf XREFsurf, triplot XREFtriplot,
trimesh XREFtrimesh, delaunay XREFdelaunay, *notepatch:
DONTPRINTYET DONTPRINTYET See also: surf XREFsurf, triplot XREFtriplot,
trimesh XREFtrimesh, delaunay XREFdelaunay, patch
XREFpatch, shading XREFshading.
-- : tetramesh (T, X)
-- : tetramesh (T, X, C)
-- : tetramesh (..., PROPERTY, VAL, ...)
-- : 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: trimesh XREFtrimesh, delaunay XREFdelaunay,
delaunayn XREFdelaunayn, patch XREFpatch.
The difference between ‘triplot’, and ‘trimesh’ or ‘trisurf’, 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.