Mercurial > octave
annotate scripts/plot/draw/isocolors.m @ 30236:628f26e122d9
maint: use rows() or columns() instead of size(__, 1 | 2) for clarity.
* ccolamd.cc, colamd.cc, Map.m, material.m, isocolors.m, isonormals.m,
isosurface.m, light.m, reducepatch.m, reducevolume.m, movfun.m, ilu.m,
__alltohandles__.m, dump_demos.m, mk-sparse-tst.sh:
Use rows() or columns() instead of size(__, 1 | 2) for clarity.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 11 Oct 2021 20:09:59 -0700 |
parents | 7854d5752dd2 |
children | 796f54d4ddbf |
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:
27978
diff
changeset
|
3 ## Copyright (C) 2009-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/>. |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
7 ## |
11104 | 8 ## This file is part of Octave. |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
11104 | 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:
24423
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:
22323
diff
changeset
|
13 ## (at your option) any later version. |
11104 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
19 ## |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
11104 | 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:
24423
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 ######################################################################## |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
25 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
22786 | 27 ## @deftypefn {} {@var{cdat} =} isocolors (@var{c}, @var{v}) |
28 ## @deftypefnx {} {@var{cdat} =} isocolors (@var{x}, @var{y}, @var{z}, @var{c}, @var{v}) | |
29 ## @deftypefnx {} {@var{cdat} =} isocolors (@var{x}, @var{y}, @var{z}, @var{r}, @var{g}, @var{b}, @var{v}) | |
30 ## @deftypefnx {} {@var{cdat} =} isocolors (@var{r}, @var{g}, @var{b}, @var{v}) | |
31 ## @deftypefnx {} {@var{cdat} =} isocolors (@dots{}, @var{p}) | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
32 ## @deftypefnx {} {} isocolors (@dots{}) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
33 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
34 ## Compute isosurface colors. |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
35 ## |
22786 | 36 ## If called with one output argument, and the first input argument @var{c} |
37 ## is a three-dimensional array that contains indexed color values, and the | |
38 ## second input argument @var{v} are the vertices of an isosurface geometry, | |
39 ## then return a matrix @var{cdat} with color data information for the geometry | |
40 ## at computed points @code{[x, y, z] = meshgrid (1:l, 1:m, 1:n)}. The output | |
41 ## argument @var{cdat} can be used to manually set the | |
42 ## @qcode{"FaceVertexCData"} property of an isosurface patch object. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
43 ## |
22786 | 44 ## If called with additional input arguments @var{x}, @var{y} and @var{z} which |
45 ## are three-dimensional arrays of the same size as @var{c} then the | |
46 ## color data is taken at those specified points. | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
47 ## |
22786 | 48 ## Instead of indexed color data @var{c}, @code{isocolors} can also be called |
49 ## with RGB values @var{r}, @var{g}, @var{b}. If input arguments @var{x}, | |
50 ## @var{y}, @var{z} are not given then @code{meshgrid} computed values are | |
51 ## used. | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
52 ## |
22786 | 53 ## Optionally, a patch handle @var{p} can be given as the last input argument |
54 ## to all function call variations and the vertex data will be extracted | |
55 ## from the isosurface patch object. Finally, if no output argument is given | |
56 ## then the colors of the patch given by the patch handle @var{p} are changed. | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
57 ## |
12529
0579a13f29a1
Add isocolors, isonormals, isosurface functions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
58 ## @seealso{isosurface, isonormals} |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
59 ## @end deftypefn |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
60 |
22786 | 61 function cdat = isocolors (varargin) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20927
diff
changeset
|
62 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
63 calc_rgb = false; |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11104
diff
changeset
|
64 switch (nargin) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
65 case 2 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
66 c = varargin{1}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
67 vp = varargin{2}; |
30236
628f26e122d9
maint: use rows() or columns() instead of size(__, 1 | 2) for clarity.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
68 x = 1:columns (c); |
628f26e122d9
maint: use rows() or columns() instead of size(__, 1 | 2) for clarity.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
69 y = 1:rows (c); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
70 z = 1:size (c, 3); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
71 case 4 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
72 calc_rgb = true; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
73 R = varargin{1}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
74 G = varargin{2}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
75 B = varargin{3}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
76 vp = varargin{4}; |
30236
628f26e122d9
maint: use rows() or columns() instead of size(__, 1 | 2) for clarity.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
77 x = 1:rows (R); |
628f26e122d9
maint: use rows() or columns() instead of size(__, 1 | 2) for clarity.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
78 y = 1:columns (R); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
79 z = 1:size (R, 3); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
80 case 5 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
81 x = varargin{1}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
82 y = varargin{2}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
83 z = varargin{3}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
84 c = varargin{4}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
85 vp = varargin{5}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
86 case 7 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
87 calc_rgb = true; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
88 x = varargin{1}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
89 y = varargin{2}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
90 z = varargin{3}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
91 R = varargin{4}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
92 G = varargin{5}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
93 B = varargin{6}; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
94 vp = varargin{7}; |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
95 otherwise |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
96 print_usage (); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
97 endswitch |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20927
diff
changeset
|
98 |
19700
00e31f316a3a
Fix Matlab incompatibility of "ismatrix" (bug #42422).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
19697
diff
changeset
|
99 if (isnumeric (vp) && columns (vp) == 3) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
100 pa = []; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
101 v = vp; |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24188
diff
changeset
|
102 elseif (isgraphics (vp, "patch")) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
103 pa = vp; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
104 v = get (pa, "Vertices"); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
105 else |
22786 | 106 error ("isocolors: last argument must be a vertex list or patch handle"); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
107 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20927
diff
changeset
|
108 |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11104
diff
changeset
|
109 if (calc_rgb) |
22786 | 110 new_colors = zeros (rows (v), 3); |
111 new_colors(:,1) = __interp_cube__ ("isocolors", x, y, z, R, v, "values"); | |
112 new_colors(:,2) = __interp_cube__ ("isocolors", x, y, z, G, v, "values"); | |
113 new_colors(:,3) = __interp_cube__ ("isocolors", x, y, z, B, v, "values"); | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
114 else |
22786 | 115 new_colors = __interp_cube__ ("isocolors", x, y, z, c, v, "values"); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
116 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20927
diff
changeset
|
117 |
22786 | 118 if (nargout == 0) |
119 if (! isempty (pa)) | |
120 set (pa, "FaceVertexCData", new_colors); | |
121 endif | |
122 else | |
123 cdat = new_colors; | |
124 endif | |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20927
diff
changeset
|
125 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
126 endfunction |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
127 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
128 |
22790 | 129 %!demo |
130 %! function isofinish (p) | |
131 %! set (gca, "PlotBoxAspectRatioMode", "manual", ... | |
132 %! "PlotBoxAspectRatio", [1 1 1]); | |
133 %! set (p, "FaceColor", "interp"); | |
134 %! set (p, "FaceLighting", "flat"); | |
135 %! light ("Position", [1 1 5]); | |
136 %! endfunction | |
137 %! | |
138 %! N = 15; # Increase number of vertices in each direction | |
139 %! iso = .4; # Change isovalue to .1 to display a sphere | |
140 %! lin = linspace (0, 2, N); | |
141 %! [x, y, z] = meshgrid (lin, lin, lin); | |
142 %! c = abs ((x-.5).^2 + (y-.5).^2 + (z-.5).^2); | |
24188
1253132e2173
Use "clf;" at beginning of all plot demos.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
143 %! clf; |
22790 | 144 %! |
145 %! subplot (2,2,1); | |
146 %! view (-38, 20); | |
147 %! [f, v] = isosurface (x, y, z, c, iso); | |
148 %! p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); | |
149 %! cdat = rand (size (c)); # Compute random color data | |
150 %! isocolors (x, y, z, cdat, p); # Directly set colors of patch | |
151 %! title ("random colors for patch handle"); | |
152 %! isofinish (p); | |
153 %! | |
154 %! subplot (2,2,2); | |
155 %! view (-38, 20); | |
156 %! p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); | |
157 %! [r, g, b] = meshgrid (lin, 2-lin, 2-lin); | |
158 %! cdat = isocolors (x, y, z, c, v); # Compute color data vertices | |
159 %! set (p, "FaceVertexCData", cdat); # Set color data manually | |
160 %! title ('random colors for "FaceVertexCData"'); | |
161 %! isofinish (p); | |
162 %! | |
163 %! subplot (2,2,3); | |
164 %! view (-38, 20); | |
165 %! p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); | |
166 %! cdat = isocolors (r, g, b, c, p); # Compute color data for patch | |
167 %! set (p, "FaceVertexCData", cdat); # Set color data manually | |
168 %! title ('random RGB colors for "FaceVertexCData"'); | |
169 %! isofinish (p); | |
170 %! | |
171 %! subplot (2,2,4); | |
172 %! view (-38, 20); | |
173 %! p = patch ("Faces", f, "Vertices", v, "EdgeColor", "none"); | |
174 %! r = g = b = repmat ([1:N] / N, [N, 1, N]); # Black to white | |
175 %! cdat = isocolors (x, y, z, r, g, b, v); | |
176 %! set (p, "FaceVertexCData", cdat); | |
177 %! title ('gray shades for "FaceVertexCData"'); | |
178 %! isofinish (p); | |
179 | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
180 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
181 %! [x, y, z] = meshgrid (0:.5:2, 0:.5:2, 0:.5:2); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
182 %! c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
183 %! [f, v] = isosurface (x, y, z, c, .4); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
184 %! cdat = isocolors (x, y, z, c, v); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
185 %! assert (rows (cdat) == rows (v)); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
186 |
22786 | 187 ## Test input validation |
28896
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
188 %!error <Invalid call> isocolors () |
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
189 %!error <Invalid call> isocolors (1) |
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
190 %!error <Invalid call> isocolors (1,2,3) |
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
191 %!error <Invalid call> isocolors (1,2,3,4,5,6) |
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
192 %!error <Invalid call> isocolors (1,2,3,4,5,6,7,8) |
22786 | 193 %!error <last argument must be a vertex list> isocolors (1, {1}) |
22790 | 194 %!error <last argument must be a vertex list> isocolors (1, [1 2 3 4]) |
22786 | 195 %!error <last argument must be a .*patch handle> isocolors (1, 0) |