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