Mercurial > octave-nkf
diff scripts/plot/draw/tetramesh.m @ 19630:0e1f5a750d00
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:24:46 -0500 |
parents | ba167badef9f 446c46af4b42 |
children | 4197fc428c7d |
line wrap: on
line diff
--- a/scripts/plot/draw/tetramesh.m Tue Jan 20 09:55:41 2015 -0500 +++ b/scripts/plot/draw/tetramesh.m Tue Jan 20 10:24:46 2015 -0500 @@ -26,19 +26,19 @@ ## @var{T} is typically the output of a Delaunay triangulation ## of a 3-D set of points. Every row of @var{T} contains four indices into ## the n-by-3 matrix @var{X} of the vertices of a tetrahedron. Every row in -## @var{X} represents one point in 3-D space. +## @var{X} represents one point in 3-D space. ## ## The vector @var{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 @var{C} are cyclically repeated. -## +## ## Calling @code{tetramesh (@dots{}, "property", "value", @dots{})} passes all ## property/value pairs directly to the patch function as additional arguments. ## ## The optional return value @var{h} is a vector of patch handles where each -## handle represents one tetrahedron in the order given by @var{T}. +## handle represents one tetrahedron in the order given by @var{T}. ## A typical use case for @var{h} is to turn the respective patch ## @qcode{"visible"} property @qcode{"on"} or @qcode{"off"}. ## @@ -67,11 +67,11 @@ size_T = rows (T); cmap = colormap (); - + if (length (reg) < 3) size_cmap = rows (cmap); C = mod ((1:size_T)' - 1, size_cmap) + 1; - if (size_T < size_cmap && size_T > 1) + if (size_T < size_cmap && size_T > 1) ## expand to the available range of colors C = floor ((C - 1) * (size_cmap - 1) / (size_T - 1)) + 1; endif @@ -90,7 +90,7 @@ ## avoiding identical faces with different colors for i = 1:size_T [th, p] = __shrink__ ([1 2 3 4], X(T(i, :), :), 1 - 1e-7); - hvec(i) = patch ("Faces", th, "Vertices", p, + hvec(i) = patch ("Faces", th, "Vertices", p, "FaceColor", cmap(C(i), :), "FaceAlpha", 0.9, prop{:}); endfor @@ -98,7 +98,7 @@ ## FLTK does not support FaceAlpha. for i = 1:size_T th = [1 2 3; 2 3 4; 3 4 1; 4 1 2]; - hvec(i) = patch ("Faces", th, "Vertices", X(T(i, :), :), + hvec(i) = patch ("Faces", th, "Vertices", X(T(i, :), :), "FaceColor", cmap(C(i), :), "FaceAlpha", 1.0, prop{:}); endfor