|
135 | 135 |
|
136 | 136 | %---------------------------------------------------------------------% |
137 | 137 |
|
138 | | - %-surface name-% |
139 | 138 | obj.data{surfaceIndex}.name = bar_data.DisplayName; |
140 | | - |
141 | | - %---------------------------------------------------------------------% |
142 | | - |
143 | | - %-surface visible-% |
144 | 139 | obj.data{surfaceIndex}.visible = strcmp(bar_data.Visible, 'on'); |
145 | 140 |
|
146 | | - %---------------------------------------------------------------------% |
147 | | - |
148 | 141 | leg = bar_data.Annotation; |
149 | 142 | legInfo = leg.LegendInformation; |
150 | | - |
151 | 143 | switch legInfo.IconDisplayStyle |
152 | 144 | case 'on' |
153 | 145 | showleg = true; |
154 | 146 | case 'off' |
155 | 147 | showleg = false; |
156 | 148 | end |
157 | | - |
158 | 149 | obj.data{surfaceIndex}.showlegend = showleg; |
159 | 150 |
|
160 | 151 | %---------------------------------------------------------------------% |
|
246 | 237 | end |
247 | 238 |
|
248 | 239 | function bar_ = bar_data(position3d, size_) |
249 | | - % position3d - 3-list or array of shape (3,) that represents the point of coords (x, y, 0), where a bar is placed |
250 | | - % size = a 3-tuple whose elements are used to scale a unit cube to get a paralelipipedic bar |
251 | | - % returns - an array of shape(8,3) representing the 8 vertices of a bar at position3d |
| 240 | + % position3d - 3-list or array of shape (3,) that represents the point |
| 241 | + % of coords (x, y, 0), where a bar is placed size = a 3-tuple whose |
| 242 | + % elements are used to scale a unit cube to get a paralelipipedic bar |
| 243 | + % returns - an array of shape(8,3) representing the 8 vertices of a bar |
| 244 | + % at position3d |
252 | 245 |
|
253 | 246 | if nargin < 2 |
254 | 247 | size_ = [1, 1, 1]; |
|
265 | 258 | 0, 1, 1 ... |
266 | 259 | ]; % the vertices of the unit cube |
267 | 260 |
|
268 | | - for n =1:size(bar_, 1) |
| 261 | + for n = 1:size(bar_, 1) |
269 | 262 | % scale the cube to get the vertices of a parallelipipedic bar_ |
270 | 263 | bar_(n,:) = bar_(n,:) .* size_; |
271 | 264 | end |
|
283 | 276 | % used in instantiating the go.Mesh3d class. |
284 | 277 |
|
285 | 278 | if nargin < 2 |
286 | | - sizes = ones(size(positions,1), 3); %[(1,1,1)]*len(positions) |
| 279 | + sizes = ones(size(positions,1), 3); % [(1,1,1)]*len(positions) |
287 | 280 | end |
288 | 281 |
|
289 | 282 | c = 1; |
|
294 | 287 | end |
295 | 288 | end |
296 | 289 |
|
297 | | - % all_bars = [bar_data(pos, size) for pos, size in zip(positions, sizes) if size[2]!=0] |
| 290 | + % all_bars = [bar_data(pos, size) for pos, size in |
| 291 | + % zip(positions, sizes) if size[2]!=0] |
298 | 292 | [r, q, p] = size(all_bars); |
299 | 293 |
|
300 | 294 | % extract unique vertices from the list of all bar vertices |
301 | 295 | all_bars = reshape(all_bars, [r, p*q])'; |
302 | 296 | [vertices, ~, ixr] = unique(all_bars, 'rows'); |
303 | 297 |
|
304 | | - %for each bar, derive the sublists of indices i, j, k assocated to its chosen triangulation |
| 298 | + % for each bar, derive the sublists of indices i, j, k assocated to its |
| 299 | + % chosen triangulation |
305 | 300 | I = []; |
306 | 301 | J = []; |
307 | 302 | K = []; |
308 | 303 |
|
309 | 304 | for k = 0:p-1 |
310 | | - aux = ixr([1+8*k, 1+8*k+2,1+8*k, 1+8*k+5,1+8*k, 1+8*k+7, 1+8*k+5, 1+8*k+2, 1+8*k+3, 1+8*k+6, 1+8*k+7, 1+8*k+5]); |
| 305 | + aux = ixr([1+8*k, 1+8*k+2,1+8*k, 1+8*k+5,1+8*k, 1+8*k+7, ... |
| 306 | + 1+8*k+5, 1+8*k+2, 1+8*k+3, 1+8*k+6, 1+8*k+7, 1+8*k+5]); |
311 | 307 | I = [ I; aux(:)]; |
312 | | - aux = ixr([1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+6, 1+8*k+7, 1+8*k+2, 1+8*k+4, 1+8*k+6]); |
| 308 | + aux = ixr([1+8*k+1, 1+8*k+3, 1+8*k+4, 1+8*k+1, 1+8*k+3, ... |
| 309 | + 1+8*k+4, 1+8*k+1, 1+8*k+6, 1+8*k+7, 1+8*k+2, 1+8*k+4, ... |
| 310 | + 1+8*k+6]); |
313 | 311 | J = [ J; aux(:)]; |
314 | | - aux = ixr([1+8*k+2, 1+8*k, 1+8*k+5, 1+8*k, 1+8*k+7, 1+8*k, 1+8*k+2, 1+8*k+5, 1+8*k+6, 1+8*k+3, 1+8*k+5, 1+8*k+7]); |
| 312 | + aux = ixr([1+8*k+2, 1+8*k, 1+8*k+5, 1+8*k, 1+8*k+7, 1+8*k, ... |
| 313 | + 1+8*k+2, 1+8*k+5, 1+8*k+6, 1+8*k+3, 1+8*k+5, 1+8*k+7]); |
315 | 314 | K = [ K; aux(:)]; |
316 | 315 | end |
317 | 316 |
|
|
0 commit comments