|
90 | 90 | end
|
91 | 91 |
|
92 | 92 | %-------------------------------------------------------------------------%
|
93 |
| - |
94 | 93 | %-get edge color-%
|
95 | 94 | if isnumeric(meshData.EdgeColor)
|
96 | 95 | cDataContour = sprintf('rgb(%f,%f,%f)', 255*meshData.EdgeColor);
|
97 | 96 |
|
98 | 97 | elseif strcmpi(meshData.EdgeColor, 'interp')
|
99 | 98 | cDataContour = zDataContour(:);
|
100 | 99 | obj.data{contourIndex}.line.colorscale = colorScale;
|
| 100 | +elseif strcmpi(meshData.EdgeColor, 'none') |
| 101 | + |
| 102 | + cDataContour = 'rgba(0,0,0,0)'; |
101 | 103 | end
|
102 | 104 |
|
103 | 105 | %-set edge color-%
|
|
123 | 125 | obj.data{surfaceIndex}.cmin = 0;
|
124 | 126 | obj.data{surfaceIndex}.cmax = 255;
|
125 | 127 |
|
126 |
| -elseif strcmpi(meshData.FaseColor, 'interp') |
| 128 | +elseif strcmpi(meshData.FaceColor, 'interp') |
127 | 129 | cDataSurface = zDataSurface;
|
| 130 | + |
| 131 | + if surfaceIndex > xsource |
| 132 | + cData = []; |
| 133 | + |
| 134 | + for idx = xsource:surfaceIndex |
| 135 | + cData = [cData; obj.data{idx}.z]; |
| 136 | + end |
| 137 | + |
| 138 | + cMin = min(cData(:)); |
| 139 | + cMax = max(cData(:)); |
| 140 | + |
| 141 | + for idx = xsource:surfaceIndex |
| 142 | + obj.data{idx}.cmin = cMin; |
| 143 | + obj.data{idx}.cmax = cMax; |
| 144 | + end |
| 145 | + end |
| 146 | + |
128 | 147 | end
|
129 | 148 |
|
130 | 149 | %-set face color-%
|
131 | 150 | obj.data{surfaceIndex}.colorscale = colorScale;
|
132 | 151 | obj.data{surfaceIndex}.surfacecolor = cDataSurface;
|
133 | 152 |
|
134 | 153 | %-lighting settings-%
|
135 |
| -obj.data{surfaceIndex}.lighting.diffuse = 0.5;%0.5; |
136 |
| -obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha);%0.7; |
| 154 | + |
| 155 | +if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1]) |
| 156 | + obj.data{surfaceIndex}.lighting.diffuse = 0.5; |
| 157 | + obj.data{surfaceIndex}.lighting.ambient = 0.725; |
| 158 | +else |
| 159 | + % obj.data{surfaceIndex}.lighting.diffuse = 1.0; |
| 160 | + % obj.data{surfaceIndex}.lighting.ambient = 0.9; |
| 161 | +end |
| 162 | + |
| 163 | +if meshData.FaceAlpha ~= 1 |
| 164 | + obj.data{surfaceIndex}.lighting.diffuse = 0.5; |
| 165 | + obj.data{surfaceIndex}.lighting.ambient = 0.725 + (1-meshData.FaceAlpha); |
| 166 | +end |
| 167 | + |
| 168 | +if obj.PlotlyDefaults.IsLight |
| 169 | + obj.data{surfaceIndex}.lighting.diffuse = 1.0; |
| 170 | + obj.data{surfaceIndex}.lighting.ambient = 0.3; |
| 171 | +end |
137 | 172 |
|
138 | 173 | %-opacity-%
|
139 | 174 | obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
|
|
157 | 192 |
|
158 | 193 | %-------------------------------------------------------------------------%
|
159 | 194 |
|
| 195 | +%-show contours-% |
| 196 | + |
| 197 | +if strcmpi(meshData.ShowContours, 'on') |
| 198 | + obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1; |
| 199 | + projectionIndex = obj.PlotOptions.nPlots; |
| 200 | + |
| 201 | + obj.data{projectionIndex}.type = 'surface'; |
| 202 | + obj.data{projectionIndex}.scene = sprintf('scene%d', xsource); |
| 203 | + |
| 204 | + obj.data{projectionIndex}.x = xDataSurface; |
| 205 | + obj.data{projectionIndex}.y = yDataSurface; |
| 206 | + obj.data{projectionIndex}.z = zDataSurface; |
| 207 | + |
| 208 | + obj.data{projectionIndex}.colorscale = colorScale; |
| 209 | + obj.data{projectionIndex}.hidesurface = true; |
| 210 | + obj.data{projectionIndex}.surfacecolor = zDataSurface; |
| 211 | + obj.data{projectionIndex}.showscale = false; |
| 212 | + |
| 213 | + obj.data{projectionIndex}.contours.z.show = true; |
| 214 | + obj.data{projectionIndex}.contours.z.width = 15; |
| 215 | + obj.data{projectionIndex}.contours.z.usecolormap = true; |
| 216 | + obj.data{projectionIndex}.contours.z.project.z = true; |
| 217 | +end |
| 218 | + |
| 219 | +%-------------------------------------------------------------------------% |
| 220 | + |
160 | 221 | %-SCENE CONFIGUTATION-%
|
161 | 222 |
|
162 | 223 | %-------------------------------------------------------------------------%
|
|
201 | 262 | %-define as default-%
|
202 | 263 | xey = - xyar; if xey>0 xfac = 0.0; else xfac = 0.0; end
|
203 | 264 | yey = - xyar; if yey>0 yfac = -0.3; else yfac = 0.3; end
|
204 |
| - if zar>0 zfac = 0.2; else zfac = -0.2; end |
| 265 | + if zar>0 zfac = 0.1; else zfac = -0.1; end |
205 | 266 |
|
206 | 267 | scene.camera.eye.x = xey + xfac*xey;
|
207 | 268 | scene.camera.eye.y = yey + yfac*yey;
|
|
261 | 322 | %-------------------------------------------------------------------------%
|
262 | 323 |
|
263 | 324 | %-surface name-%
|
| 325 | +obj.data{surfaceIndex}.name = meshData.DisplayName; |
264 | 326 | obj.data{contourIndex}.name = meshData.DisplayName;
|
265 | 327 |
|
266 | 328 | %-------------------------------------------------------------------------%
|
|
272 | 334 | %-------------------------------------------------------------------------%
|
273 | 335 |
|
274 | 336 | %-surface visible-%
|
| 337 | +obj.data{surfaceIndex}.visible = strcmp(meshData.Visible,'on'); |
275 | 338 | obj.data{contourIndex}.visible = strcmp(meshData.Visible,'on');
|
276 | 339 |
|
277 | 340 | %-------------------------------------------------------------------------%
|
|
286 | 349 | showleg = false;
|
287 | 350 | end
|
288 | 351 |
|
289 |
| -obj.data{contourIndex}.showlegend = showleg; |
| 352 | +obj.data{surfaceIndex}.showlegend = showleg; |
290 | 353 |
|
291 | 354 | %-------------------------------------------------------------------------%
|
292 | 355 |
|
|
0 commit comments