Mercurial > hg > octave-lyh
annotate scripts/plot/private/__patch__.m @ 13256:41c2f4633a62
Properly process 'cdata' property for patches (Bug #34417).
* __patch__.m: Guarantee that 'cdata' and 'facevertexcdata' are transposes of
each other.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 28 Sep 2011 09:14:45 -0700 |
parents | e749d0b568c8 |
children | e9f6a6edec42 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2007-2011 John W. Eaton, Shai Ayal, Kai Habel |
6807 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6807 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6807 | 18 |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8190
diff
changeset
|
19 ## -*- texinfo -*- |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8190
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{h}, @var{fail}] =} __patch__ (@var{p}, @dots{}) |
6895 | 21 ## Undocumented internal function. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8190
diff
changeset
|
22 ## @end deftypefn |
6895 | 23 |
24 ## __patch__ (p, x, y, c) | |
25 ## Create patch object from x and y with color c and parent p. | |
6807 | 26 ## Return handle to patch object. |
27 | |
28 ## Author: Kai Habel | |
29 | |
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:
8920
diff
changeset
|
30 function [h, failed] = __patch__ (p, varargin) |
7191 | 31 |
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:
8920
diff
changeset
|
32 failed = false; |
6885 | 33 |
13115
cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents:
12931
diff
changeset
|
34 if (isempty (varargin)) |
cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents:
12931
diff
changeset
|
35 args = {"xdata", [0; 1; 1], "ydata", [0; 0; 1], "facecolor", "blue"}; |
cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents:
12931
diff
changeset
|
36 args = setvertexdata (args); |
cd808de114c1
Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents:
12931
diff
changeset
|
37 elseif (isstruct (varargin{1})) |
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:
8920
diff
changeset
|
38 if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces")) |
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:
8920
diff
changeset
|
39 args{1} = "faces"; |
9111 | 40 args{2} = getfield(varargin{1}, "faces"); |
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:
8920
diff
changeset
|
41 args{3} = "vertices"; |
9111 | 42 args{4} = getfield(varargin{1}, "vertices"); |
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:
8920
diff
changeset
|
43 args{5} = "facevertexcdata"; |
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:
8920
diff
changeset
|
44 if (isfield (varargin{1}, "facevertexcdata")) |
10549 | 45 args{6} = getfield(varargin{1}, "facevertexcdata"); |
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:
8920
diff
changeset
|
46 else |
10549 | 47 args{6} = []; |
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:
8920
diff
changeset
|
48 endif |
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:
8920
diff
changeset
|
49 args = [args; varargin(2:end)]; |
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:
8920
diff
changeset
|
50 args = setdata (args); |
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:
8920
diff
changeset
|
51 else |
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:
8920
diff
changeset
|
52 failed = true; |
7020 | 53 endif |
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:
8920
diff
changeset
|
54 elseif (isnumeric (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:
8920
diff
changeset
|
55 if (nargin < 3 || ! isnumeric (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:
8920
diff
changeset
|
56 failed = true; |
7020 | 57 else |
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:
8920
diff
changeset
|
58 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:
8920
diff
changeset
|
59 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:
8920
diff
changeset
|
60 iarg = 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:
8920
diff
changeset
|
61 |
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:
8920
diff
changeset
|
62 if (nargin > 3 && ndims (varargin{3}) == 2 && ndims (x) == 2 |
10549 | 63 && size_equal(x, varargin{3}) && !ischar(varargin{3})) |
64 z = varargin{3}; | |
65 iarg++; | |
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:
8920
diff
changeset
|
66 else |
10549 | 67 z = []; |
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:
8920
diff
changeset
|
68 endif |
6885 | 69 |
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:
8920
diff
changeset
|
70 if (isvector (x)) |
10549 | 71 x = x(:); |
72 y = y(:); | |
73 z = z(:); | |
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:
8920
diff
changeset
|
74 endif |
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:
8920
diff
changeset
|
75 args{1} = "xdata"; |
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:
8920
diff
changeset
|
76 args{2} = x; |
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:
8920
diff
changeset
|
77 args{3} = "ydata"; |
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:
8920
diff
changeset
|
78 args{4} = y; |
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:
8920
diff
changeset
|
79 args{5} = "zdata"; |
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:
8920
diff
changeset
|
80 args{6} = z; |
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:
8920
diff
changeset
|
81 |
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:
8920
diff
changeset
|
82 if (isnumeric (varargin{iarg})) |
10549 | 83 c = varargin{iarg}; |
84 iarg++; | |
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:
8920
diff
changeset
|
85 |
10549 | 86 if (ndims (c) == 3 && size (c, 2) == 1) |
87 c = permute (c, [1, 3, 2]); | |
88 endif | |
6885 | 89 |
10549 | 90 if (isvector (c) && numel (c) == columns (x)) |
91 if (isnan (c)) | |
92 args{7} = "facecolor"; | |
93 args{8} = [1, 1, 1]; | |
94 args{9} = "cdata"; | |
95 args{10} = c; | |
96 elseif (isnumeric (c)) | |
97 args{7} = "facecolor"; | |
98 args{8} = "flat"; | |
99 args{9} = "cdata"; | |
100 args{10} = c; | |
101 else | |
102 error ("patch: color value not valid"); | |
103 endif | |
104 elseif (size (c, ndims (c)) == 3) | |
105 args{7} = "facecolor"; | |
106 args{8} = "flat"; | |
107 args{9} = "cdata"; | |
108 args{10} = c; | |
109 else | |
110 ## Color Vectors | |
111 if (rows (c) != rows (x) || rows (c) != length (y)) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11587
diff
changeset
|
112 error ("patch: size of x, y, and c must be equal"); |
10549 | 113 else |
114 args{7} = "facecolor"; | |
115 args{8} = "interp"; | |
116 args{9} = "cdata"; | |
117 args{10} = []; | |
118 endif | |
119 endif | |
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:
8920
diff
changeset
|
120 elseif (ischar (varargin{iarg}) && rem (nargin - iarg, 2) != 0) |
10549 | 121 ## Assume that any additional argument over an even number is |
122 ## color string. | |
123 args{7} = "facecolor"; | |
124 args{8} = tolower (varargin{iarg}); | |
125 args{9} = "cdata"; | |
126 args{10} = []; | |
127 iarg++; | |
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:
8920
diff
changeset
|
128 else |
10549 | 129 args{7} = "facecolor"; |
130 args{8} = [0, 1, 0]; | |
131 args{9} = "cdata"; | |
132 args{10} = []; | |
6925 | 133 endif |
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:
8920
diff
changeset
|
134 |
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:
8920
diff
changeset
|
135 args = [args, varargin(iarg:end)]; |
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:
8920
diff
changeset
|
136 args = setvertexdata (args); |
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:
8920
diff
changeset
|
137 endif |
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:
8920
diff
changeset
|
138 else |
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:
8920
diff
changeset
|
139 args = varargin; |
12931
cefd568ea073
Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
140 if (any (strcmpi (args, "faces") | strcmpi (args, "vertices"))) |
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:
8920
diff
changeset
|
141 args = setdata (args); |
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:
8920
diff
changeset
|
142 else |
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:
8920
diff
changeset
|
143 args = setvertexdata (args); |
6885 | 144 endif |
145 endif | |
146 | |
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:
8920
diff
changeset
|
147 if (!failed) |
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:
8920
diff
changeset
|
148 h = __go_patch__ (p, args {:}); |
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:
8920
diff
changeset
|
149 |
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:
8920
diff
changeset
|
150 ## Setup listener functions |
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:
8920
diff
changeset
|
151 addlistener (h, "xdata", @update_data); |
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:
8920
diff
changeset
|
152 addlistener (h, "ydata", @update_data); |
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:
8920
diff
changeset
|
153 addlistener (h, "zdata", @update_data); |
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:
8920
diff
changeset
|
154 addlistener (h, "cdata", @update_data); |
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:
8920
diff
changeset
|
155 |
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:
8920
diff
changeset
|
156 addlistener (h, "faces", @update_fvc); |
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:
8920
diff
changeset
|
157 addlistener (h, "vertices", @update_fvc); |
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:
8920
diff
changeset
|
158 addlistener (h, "facevertexcdata", @update_fvc); |
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:
8920
diff
changeset
|
159 endif |
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:
8920
diff
changeset
|
160 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:
8920
diff
changeset
|
161 |
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:
8920
diff
changeset
|
162 function args = delfields(args, flds) |
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:
8920
diff
changeset
|
163 idx = cellfun (@(x) any (strcmpi (x, flds)), args); |
10569
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
164 if (rows (idx) == 1) |
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
165 idx = idx | [false, idx(1:end-1)]; |
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
166 else |
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
167 idx = idx | [false; idx(1:end-1)]; |
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
168 endif |
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:
8920
diff
changeset
|
169 args (idx) = []; |
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:
8920
diff
changeset
|
170 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:
8920
diff
changeset
|
171 |
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:
8920
diff
changeset
|
172 function args = setdata (args) |
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:
8920
diff
changeset
|
173 args = delfields (args, {"xdata", "ydata", "zdata", "cdata"}); |
10569
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
174 ## Remove the readonly fields as well |
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
175 args = delfields (args, {"type", "uicontextmenu"}); |
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:
8920
diff
changeset
|
176 nargs = length (args); |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
177 idx = find (strcmpi (args, "faces"), 1, "last") + 1; |
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:
8920
diff
changeset
|
178 if (idx > nargs) |
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:
8920
diff
changeset
|
179 faces = []; |
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:
8920
diff
changeset
|
180 else |
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:
8920
diff
changeset
|
181 faces = args {idx}; |
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:
8920
diff
changeset
|
182 endif |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
183 idx = find (strcmpi (args, "vertices"), 1, "last") + 1; |
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:
8920
diff
changeset
|
184 if (idx > nargs) |
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:
8920
diff
changeset
|
185 vert = []; |
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:
8920
diff
changeset
|
186 else |
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:
8920
diff
changeset
|
187 vert = args {idx}; |
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:
8920
diff
changeset
|
188 endif |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
189 idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1; |
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:
8920
diff
changeset
|
190 if (isempty(idx) || idx > nargs) |
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:
8920
diff
changeset
|
191 fvc = []; |
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:
8920
diff
changeset
|
192 else |
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:
8920
diff
changeset
|
193 fvc = args {idx}; |
6807 | 194 endif |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
195 idx = find (strcmpi (args, "facecolor"), 1, "last") + 1; |
9118
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
196 if (isempty(idx) || idx > nargs) |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
197 if (!isempty (fvc)) |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
198 fc = "flat"; |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
199 else |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
200 fc = [0, 1, 0]; |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
201 endif |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
202 args = {"facecolor", fc, args{:}}; |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
203 else |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
204 fc = args {idx}; |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
205 endif |
6807 | 206 |
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:
8920
diff
changeset
|
207 nr = size (faces, 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:
8920
diff
changeset
|
208 nc = size (faces, 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:
8920
diff
changeset
|
209 idx = faces .'; |
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:
8920
diff
changeset
|
210 t1 = isnan (idx); |
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:
8920
diff
changeset
|
211 if (any (t1(:))) |
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:
8920
diff
changeset
|
212 t2 = find (t1 != t1([2:end,end],:)); |
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:
8920
diff
changeset
|
213 idx (t1) = idx (t2 (cell2mat (cellfun (@(x) x(1)*ones(1,x(2)), |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
214 mat2cell ([1 : nc; sum(t1)], 2, ones(1,nc)), |
11191
01ddaedd6ad5
Reverse changeset b1f4bdc276b6. Use all lower case for "uniformoutput" option.
Rik <octave@nomad.inbox5.com>
parents:
11188
diff
changeset
|
215 "uniformoutput", false)))); |
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:
8920
diff
changeset
|
216 endif |
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:
8920
diff
changeset
|
217 x = reshape (vert(:,1)(idx), size (idx)); |
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:
8920
diff
changeset
|
218 y = reshape (vert(:,2)(idx), size (idx)); |
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:
8920
diff
changeset
|
219 if (size(vert,2) > 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:
8920
diff
changeset
|
220 z = reshape (vert(:,3)(idx), size (idx)); |
6807 | 221 else |
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:
8920
diff
changeset
|
222 z = []; |
6807 | 223 endif |
6886 | 224 |
11160
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
225 if (size(fvc, 1) == nc || size (fvc, 1) == 1) |
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
226 c = reshape (fvc, [1, size(fvc)]); |
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
227 else |
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
228 if (size(fvc, 2) == 3) |
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
229 c = cat(3, reshape (fvc(idx, 1), size(idx)), |
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
230 reshape (fvc(idx, 2), size(idx)), |
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
231 reshape (fvc(idx, 3), size(idx))); |
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:
8920
diff
changeset
|
232 else |
11187
0a8e554494c9
__patch__.m: Don't index an empty array; bug introduced by changeset 11175.
Ben Abbott <bpabbott@mac.com>
parents:
11160
diff
changeset
|
233 c = []; |
7020 | 234 endif |
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:
8920
diff
changeset
|
235 endif |
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:
8920
diff
changeset
|
236 args = {"xdata", x, "ydata", y, "zdata", z, "cdata", c, args{:}}; |
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:
8920
diff
changeset
|
237 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:
8920
diff
changeset
|
238 |
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:
8920
diff
changeset
|
239 function args = setvertexdata (args) |
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:
8920
diff
changeset
|
240 args = delfields (args, {"vertices", "faces", "facevertexcdata"}); |
10569
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
241 ## Remove the readonly fields as well |
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
242 args = delfields (args, {"type", "uicontextmenu"}); |
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:
8920
diff
changeset
|
243 nargs = length (args); |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
244 idx = find (strcmpi (args, "xdata"), 1, "last") + 1; |
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:
8920
diff
changeset
|
245 if (idx > nargs) |
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:
8920
diff
changeset
|
246 x = []; |
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:
8920
diff
changeset
|
247 else |
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:
8920
diff
changeset
|
248 x = args {idx}; |
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:
8920
diff
changeset
|
249 endif |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
250 idx = find (strcmpi (args, "ydata"), 1, "last") + 1; |
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:
8920
diff
changeset
|
251 if (idx > nargs) |
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:
8920
diff
changeset
|
252 y = []; |
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:
8920
diff
changeset
|
253 else |
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:
8920
diff
changeset
|
254 y = args {idx}; |
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:
8920
diff
changeset
|
255 endif |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
256 idx = find (strcmpi (args, "zdata"), 1, "last") + 1; |
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:
8920
diff
changeset
|
257 if (isempty(idx) || idx > nargs) |
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:
8920
diff
changeset
|
258 z = []; |
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:
8920
diff
changeset
|
259 else |
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:
8920
diff
changeset
|
260 z = args {idx}; |
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:
8920
diff
changeset
|
261 endif |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
262 idx = find (strcmpi (args, "cdata"), 1, "last") + 1; |
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:
8920
diff
changeset
|
263 if (isempty(idx) || idx > nargs) |
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:
8920
diff
changeset
|
264 c = []; |
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:
8920
diff
changeset
|
265 else |
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:
8920
diff
changeset
|
266 c = args {idx}; |
7020 | 267 endif |
11188
4cb1522e4d0f
Use function handle as input to cellfun,
Rik <octave@nomad.inbox5.com>
parents:
11187
diff
changeset
|
268 idx = find (strcmpi (args, "facecolor"), 1, "last") + 1; |
9118
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
269 if (isempty(idx) || idx > nargs) |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
270 if (!isempty (c)) |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
271 fc = "flat"; |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
272 else |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
273 fc = [0, 1, 0]; |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
274 endif |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
275 args = {"facecolor", fc, args{:}}; |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
276 else |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
277 fc = args {idx}; |
308311b642b2
Explicitly set the default facecolor of patches
David Bateman <dbateman@free.fr>
parents:
9111
diff
changeset
|
278 endif |
7020 | 279 |
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:
8920
diff
changeset
|
280 [nr, nc] = size (x); |
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:
8920
diff
changeset
|
281 if (!isempty (z)) |
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:
8920
diff
changeset
|
282 vert = [x(:), y(:), z(:)]; |
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:
8920
diff
changeset
|
283 else |
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:
8920
diff
changeset
|
284 vert = [x(:), y(:)]; |
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:
8920
diff
changeset
|
285 endif |
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:
8920
diff
changeset
|
286 faces = reshape (1:numel(x), rows (x), columns (x)); |
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:
8920
diff
changeset
|
287 faces = faces'; |
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:
8920
diff
changeset
|
288 |
11160
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
289 if (ndims (c) == 3) |
131d56b6d9a3
Set cdata from facevertexcdata and visa versa for patch at all times
David Bateman <dbateman@free.fr>
parents:
10569
diff
changeset
|
290 fvc = reshape (c, size (c, 1) * size (c, 2), size(c, 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:
8920
diff
changeset
|
291 else |
13256
41c2f4633a62
Properly process 'cdata' property for patches (Bug #34417).
Rik <rik@octave.org>
parents:
13253
diff
changeset
|
292 fvc = c.'; |
7020 | 293 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
294 |
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:
8920
diff
changeset
|
295 args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}}; |
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:
8920
diff
changeset
|
296 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:
8920
diff
changeset
|
297 |
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:
8920
diff
changeset
|
298 function update_data (h, d) |
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:
8920
diff
changeset
|
299 update_handle (h, false); |
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:
8920
diff
changeset
|
300 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:
8920
diff
changeset
|
301 |
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:
8920
diff
changeset
|
302 function update_fvc (h, d) |
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:
8920
diff
changeset
|
303 update_handle (h, true); |
6807 | 304 endfunction |
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:
8920
diff
changeset
|
305 |
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:
8920
diff
changeset
|
306 function update_handle (h, isfv) |
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:
8920
diff
changeset
|
307 persistent recursive = false; |
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:
8920
diff
changeset
|
308 |
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:
8920
diff
changeset
|
309 if (! recursive) |
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:
8920
diff
changeset
|
310 recursive = 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:
8920
diff
changeset
|
311 f = get (h); |
10524
1c6ff93c025a
Reimplement the other discrete distribution functions using lookup
David Bateman <dbateman@free.fr>
parents:
9896
diff
changeset
|
312 if (isfv) |
10569
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
313 set (h, setdata ([fieldnames(f), struct2cell(f)].'(:)){:}); |
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:
8920
diff
changeset
|
314 else |
10569
4f2e46473153
Fix the order of calling setdata and setvertexdata for patches (bug #29549)
David Bateman <dbateman@free.fr>
parents:
10549
diff
changeset
|
315 set (h, setvertexdata ([fieldnames(f), struct2cell(f)].'(:)){:}); |
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:
8920
diff
changeset
|
316 endif |
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:
8920
diff
changeset
|
317 recursive = false; |
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:
8920
diff
changeset
|
318 endif |
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:
8920
diff
changeset
|
319 endfunction |