annotate scripts/plot/draw/tetramesh.m @ 29358:0a5b15007766 stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2021 09:52:15 -0500
parents 9342688e86b4
children 7854d5752dd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 28733
diff changeset
3 ## Copyright (C) 2012-2021 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
7 ##
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
8 ## This file is part of Octave.
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22351
diff changeset
13 ## (at your option) any later version.
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
14 ##
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22351
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22351
diff changeset
18 ## GNU General Public License for more details.
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
19 ##
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
25
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
27 ## @deftypefn {} {} tetramesh (@var{T}, @var{X})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
28 ## @deftypefnx {} {} tetramesh (@var{T}, @var{X}, @var{C})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
29 ## @deftypefnx {} {} tetramesh (@dots{}, @var{property}, @var{val}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
30 ## @deftypefnx {} {@var{h} =} tetramesh (@dots{})
21546
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 20852
diff changeset
31 ## Display the tetrahedrons defined in the m-by-4 matrix @var{T} as 3-D
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 20852
diff changeset
32 ## patches.
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
33 ##
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
34 ## @var{T} is typically the output of a Delaunay triangulation of a 3-D set
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
35 ## of points. Every row of @var{T} contains four indices into the n-by-3
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
36 ## matrix @var{X} of the vertices of a tetrahedron. Every row in @var{X}
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
37 ## represents one point in 3-D space.
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
38 ##
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
39 ## The vector @var{C} specifies the color of each tetrahedron as an index
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
40 ## into the current colormap. The default value is 1:m where m is the number
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
41 ## of tetrahedrons; the indices are scaled to map to the full range of the
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
42 ## colormap. If there are more tetrahedrons than colors in the colormap then
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
43 ## the values in @var{C} are cyclically repeated.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
44 ##
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
45 ## Calling @code{tetramesh (@dots{}, "property", "value", @dots{})} passes all
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
46 ## property/value pairs directly to the patch function as additional arguments.
28733
9342688e86b4 Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents: 27978
diff changeset
47 ## The full list of properties is documented at @ref{Patch Properties}.
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
48 ##
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
49 ## The optional return value @var{h} is a vector of patch handles where each
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
50 ## handle represents one tetrahedron in the order given by @var{T}.
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17122
diff changeset
51 ## A typical use case for @var{h} is to turn the respective patch
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17122
diff changeset
52 ## @qcode{"visible"} property @qcode{"on"} or @qcode{"off"}.
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
53 ##
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
54 ## Type @code{demo tetramesh} to see examples on using @code{tetramesh}.
19164
ba167badef9f Deprecate delaunay3 and extend delaunay to 3-D inputs.
Rik <rik@octave.org>
parents: 17744
diff changeset
55 ## @seealso{trimesh, delaunay, delaunayn, patch}
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
56 ## @end deftypefn
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
57
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
58 function h = tetramesh (varargin)
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
59
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
60 [reg, prop] = parseparams (varargin);
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
61
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
62 if (length (reg) < 2 || length (reg) > 3)
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
63 print_usage ();
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
64 endif
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
65
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
66 T = reg{1};
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
67 X = reg{2};
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
68
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
69 if (! ismatrix (T) || columns (T) != 4)
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
70 error ("tetramesh: T must be an n-by-4 matrix");
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
71 elseif (! ismatrix (X) || columns (X) != 3)
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
72 error ("tetramesh: X must be an n-by-3 matrix");
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
73 endif
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
74
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
75 size_T = rows (T);
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
76 cmap = colormap ();
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
77
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
78 if (length (reg) < 3)
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
79 size_cmap = rows (cmap);
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
80 C = mod ((1:size_T)' - 1, size_cmap) + 1;
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
81 if (size_T < size_cmap && size_T > 1)
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
82 ## expand to the available range of colors
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
83 C = floor ((C - 1) * (size_cmap - 1) / (size_T - 1)) + 1;
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
84 endif
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
85 else
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
86 C = reg{3};
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
87 if (! isvector (C) || size_T != length (C))
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
88 error ("tetramesh: C must be a vector of the same length as T");
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
89 endif
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
90 endif
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
91
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
92 hax = newplot ();
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
93
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
94 hvec = zeros (size_T, 1);
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
95 if (strcmp (graphics_toolkit (), "gnuplot"))
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
96 ## Tiny reduction of the tetrahedron size to help gnuplot by
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
97 ## avoiding identical faces with different colors
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
98 for i = 1:size_T
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
99 [th, p] = __shrink__ ([1 2 3 4], X(T(i, :), :), 1 - 1e-7);
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
100 hvec(i) = patch ("Faces", th, "Vertices", p,
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
101 "FaceColor", cmap(C(i), :), "FaceAlpha", 0.9,
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
102 prop{:});
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
103 endfor
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
104 else
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
105 ## FLTK does not support FaceAlpha.
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
106 for i = 1:size_T
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
107 th = [1 2 3; 2 3 4; 3 4 1; 4 1 2];
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
108 hvec(i) = patch ("Faces", th, "Vertices", X(T(i, :), :),
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
109 "FaceColor", cmap(C(i), :), "FaceAlpha", 1.0,
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
110 prop{:});
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
111 endfor
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
112 endif
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
113
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
114 if (! ishold ())
22351
e6df1ddfc3cf Change DefaultAxesBox property to "off".
Rik <rik@octave.org>
parents: 22323
diff changeset
115 set (hax, "view", [-37.5, 30]);
17506
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
116 endif
1ccff59592f0 tetramesh.m: Overhaul function.
Rik <rik@octave.org>
parents: 17281
diff changeset
117
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
118 if (nargout > 0)
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
119 h = hvec;
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
120 endif
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
121
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
122 endfunction
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
123
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
124 ## shrink the tetrahedron relative to its center of gravity
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
125 function [tri, p] = __shrink__ (T, X, sf)
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
126 midpoint = repmat (sum (X(T, :), 1) / 4, 12, 1);
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
127 p = [X([1 2 3], :); X([2 3 4], :); X([3 4 1], :); X([4 1 2], :)];
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
128 p = sf * (p - midpoint) + midpoint;
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
129 tri = reshape (1:12, 3, 4)';
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
130 endfunction
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
131
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
132
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
133 %!demo
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
134 %! clf;
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
135 %! d = [-1 1];
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
136 %! [x,y,z] = meshgrid (d, d, d);
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
137 %! x = [x(:); 0];
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
138 %! y = [y(:); 0];
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
139 %! z = [z(:); 0];
19164
ba167badef9f Deprecate delaunay3 and extend delaunay to 3-D inputs.
Rik <rik@octave.org>
parents: 17744
diff changeset
140 %! tetra = delaunay (x, y, z);
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
141 %! X = [x(:) y(:) z(:)];
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
142 %! colormap (jet (64));
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
143 %! h = tetramesh (tetra, X);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21546
diff changeset
144 %! set (h(1:2:end), "visible", "off");
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
145 %! axis equal;
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
146 %! view (30, 20);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21546
diff changeset
147 %! title ({"tetramesh() plot", ...
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21546
diff changeset
148 %! "colormap = jet (64), every other tetrahedron invisible"});
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
149
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
150 %!demo
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
151 %! clf;
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
152 %! d = [-1 1];
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
153 %! [x,y,z] = meshgrid (d, d, d);
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
154 %! x = [x(:); 0];
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
155 %! y = [y(:); 0];
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
156 %! z = [z(:); 0];
19164
ba167badef9f Deprecate delaunay3 and extend delaunay to 3-D inputs.
Rik <rik@octave.org>
parents: 17744
diff changeset
157 %! tetra = delaunay (x, y, z);
14514
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
158 %! X = [x(:) y(:) z(:)];
34a9fdaa6ea3 New Function, tetramesh.m
Martin Helm <martin@mhelm.de>
parents:
diff changeset
159 %! colormap (gray (256));
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21546
diff changeset
160 %! tetramesh (tetra, X, 21:20:241, "EdgeColor", "w");
14541
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
161 %! axis equal;
759944521fd6 Improve tetramesh docstring and add function to manual.
Rik <octave@nomad.inbox5.com>
parents: 14514
diff changeset
162 %! view (30, 20);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21546
diff changeset
163 %! title ({"tetramesh() plot", ...
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21546
diff changeset
164 %! "colormap = gray (256) with white edges"});